Ohm
A JavaScript library for building parsers, interpreters, compilers, and more.
Ohm is a parsing toolkit consisting of a library and a domain-specific language. You can use it to parse custom file formats or quickly build parsers, interpreters, and compilers for programming languages.
The Ohm language is based on parsing expression grammars (PEGs), which are a formal way of describing syntax, similar to regular expressions and context-free grammars. The Ohm library provides a JavaScript interface for creating parsers, interpreters, and more from the grammars you write.
⚡️ Powerful grammar language
Full support for left recursion lets you define left-associative operators in a natural way.
Object-oriented grammar extension makes it easy to extend an existing language with new syntax.
📦 Modular semantic actions
Unlike many similar tools, Ohm completely separates grammars from semantic actions. This improves modularity and extensibility, and makes both grammars and semantic actions easier to read and understand.
🦸 Online editor and visualizer
The Ohm Editor provides instant feedback and an interactive visualization makes the entire execution of the parser visible and tangible. It'll make you feel like you have superpowers.
What can you do with it?
Here are some awesome things people have built using Ohm:
- Seymour, a live programming environment for the classroom.
- Shadama, a particle simulation language designed for high-school science.
- Slang, a browser-based audio programming language, and turtle.audio, a music sequencer inspired by turtle graphics programming.
- Simpletalk is an expressive, programmable authoring system inspired by Hypercard and Smalltalk. (See also the StrangeLoop talk).
- Wildcard, a browser extension that empowers anyone to modify websites to meet their own specific needs, uses Ohm for its spreadsheet formulas.
- JAMScript is a programming language for edge-based IoT applications.
- Bruno is an open source IDE for exploring and testing APIs.
Academic Publications
- Incremental Packrat Parsing (SLE 2017)
- Language Hacking in a Live Programming Environment (LIVE 2016)
- Modular Semantic Actions (DLS 2016)