Ohm's Peg-to-WASM Compiler

Ohm goes 50x faster with a web-speed boost — fans cheer, purists grumble

TLDR: Ohm’s new version compiles its rules to fast web code and claims 50x speed with a fraction of memory. Fans hype real projects and speed, while skeptics revive the PEG vs. EBNF battle over safety and ambiguity—making this performance leap both a big win and a fresh culture clash.

Ohm just hit the nitrous: the new v18 compiles its language rules into WebAssembly (think: super-fast web code), boasting 50x faster parsing while sipping about 10% of the memory. Devs who build mini-languages and data readers are buzzing, and longtime follower joshmarinacci showed receipts, praising Ohm as his favorite parser and linking a real project parsing Markdown with it here. It’s the classic internet arc: one half is high-fiving, the other half is side-eying.

The drama? A familiar feud erupts: PEGs (Parsing Expression Grammars) vs EBNF (a traditional way to describe languages). User quotemstr rolled in with the hot take that PEGs can be “footguns” because order matters and they don’t warn you about ambiguous rules—translation: powerful, but you can shoot yourself in the foot. That sent folks to the reading room, with shoo dropping a decade-old explainer on LL and LR parsers (other classic parser styles) and how they stack up with PEGs, complete with deep nerd context here. Meanwhile, kristianp stirred the practical pot asking what people actually built—and then pulled a genealogy thread, tracing Ohm back to OMeta at the Viewpoints Research Institute wiki, paper.

Call it Team Speed vs. Team Safety: one side dazzled by raw performance, the other waving caution flags. And yes, somewhere in there, people are already dreaming up brand-new mini-languages—and sharpening their grammar knives.

Key Points

  • Ohm v18 beta introduces a new parsing engine that compiles PEG-based grammars into WebAssembly modules.
  • The team reports v18 is more than 50x faster on real-world grammars and uses about 10% of the memory compared to prior versions.
  • Earlier versions (through v17) interpreted PExpr ASTs at runtime, with nodes like Alt, Apply, Opt, Seq, and Term implementing eval methods.
  • The v18 architecture splits into AssemblyScript-based runtime support and a TypeScript-based WebAssembly code generator, with an IR lowering step.
  • Code generation in v18 inlines logic (e.g., Alt handling) and avoids generic runtime dispatch, contributing to performance gains.

Hottest takes

“it’s the best way to build parsers I’ve ever seen” — joshmarinacci
“order-dependence of PEG alternatives and the lack of ambiguity detection are footguns” — quotemstr
“What have people built with it?” — kristianp
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.