Ohm is a parsing toolkit consisting of a library and domain-specific language for building parsers, interpreters, and compilers.
Ohm addresses the problem of creating parsers for custom syntaxes and programming languages by combining a grammar language based on parsing expression grammars with a JavaScript library that executes those grammars. The grammar language supports left-recursive rules, allowing natural definition of left-associative operators, and can be extended through object-oriented grammar inheritance. The toolkit's distinctive architectural choice is complete separation of grammars from semantic actions, which are defined as modular JavaScript functions rather than embedded in the grammar itself. This separation improves readability and makes both grammars and semantic actions easier to maintain and reuse across different contexts.
Ohm suits developers building domain-specific languages, custom file format parsers, or language implementations who want a clear separation between syntax definition and interpretation logic. The project provides an interactive online editor with real-time visualization of parser execution, which helps developers understand and debug their grammars. This tool works well for educational contexts and rapid prototyping where visibility into parsing behavior is valuable. The toolkit has been used to build live programming environments, particle simulation languages, audio synthesis tools, and browser extensions that parse user-defined formulas.
The project maintains active development with regular updates to its codebase and documentation. The maintainers engage with the community through a dedicated Discord channel for discussion and support. The toolkit includes comprehensive examples and interactive learning resources, including JSFiddle demonstrations and an online editor that serves as both a development environment and educational tool.