Sign in

OhmJS

@ohmjs.org
89 followers 55 following 32 posts

A user-friendly parsing toolkit for JavaScript and TypeScript ∙ ohmjs.org

PostsRepliesMedia
Reposted by OhmJS
Patrick Dubroy @dubroy.com · 24/03/2026
New post on the @ohmjs.org blog — Inside Ohm's PEG-to-Wasm compiler → ohmjs.org/blog/2026/03... v18 is now more than 50x faster for real-world grammars while using about 10% of the memory 🔥 …this post goes into the details of how it's built.
Bar chart comparing performance improvements across three technologies: JSON shows 15.6ms (v17) reduced to 0.35ms (v18), a 44.6x speed increase; LiquidHTML shows 2,250ms (JS) reduced to 36ms (Wasm), a 62.8x speed increase; and ES5 shows 3,308ms (JS) reduced to 55ms (Wasm), a 60.3x speed increase. Blue bars represent 'Before' measurements and green bars represent 'After' measurements
0104
Reposted by OhmJS
Patrick Dubroy @dubroy.com · 13/03/2026
One more time — I'm looking for new consulting clients. Some ways I can help: ∙ Fractional tech leadership (tackling "leadership debt" in small eng orgs) ∙ Full-stack, 0 to 1 projects ∙ Language design & impl (eg with @ohmjs.org) ∙ JavaScript/TypeScript perf (🔁 appreciated)
01115
OhmJS @ohmjs.org · 27/02/2026
Whoah. Today we discovered that ohm-js is now a "high-impact" NPM package (>1M downloads/week). The mystery was: why? Turns out it's now a transitive dependency of the Vercel CLI, via pip-requirements-js, an Ohm-based package for parsing requirements.txt files: github.com/Twixes/pip-r...
Line chart showing weekly downloads for the npm package "ohm-js" from February 28, 2025 to February 26, 2026. The graph displays relatively flat growth at around 200,000 weekly downloads for most of the year, then shows dramatic exponential growth starting in late January 2026, skyrocketing from approximately 200,000 to 1.8 million weekly downloads by late February 2026. The y-axis shows weekly downloads ranging from 0 to 1.8M, and the x-axis shows dates with major tick marks every few months
040
OhmJS @ohmjs.org · 23/02/2026
Take a look if you're interested in using Ohm to compile to #Wasm. (This is the same library we use in the new Ohm v18 beta that compiles grammars to Wasm.)
031
Reposted by OhmJS
OhmJS @ohmjs.org · 20/02/2026
A couple big announcements for y'all — 1️⃣ We have a blog now! 2️⃣ We just published the beta version of Ohm v18: ohmjs.org/blog/ohm-v18 Give it a spin and tell us what you think!
ohmjs.org
Ohm v18 Beta | Ohm
Ohm v18 compiles grammars to WebAssembly, making parsing ~20x faster and using a fraction of the memory.
011
OhmJS @ohmjs.org · 20/02/2026
A couple big announcements for y'all — 1️⃣ We have a blog now! 2️⃣ We just published the beta version of Ohm v18: ohmjs.org/blog/ohm-v18 Give it a spin and tell us what you think!
ohmjs.org
Ohm v18 Beta | Ohm
Ohm v18 compiles grammars to WebAssembly, making parsing ~20x faster and using a fraction of the memory.
011
OhmJS @ohmjs.org · 12/02/2026
Btw, if you have a fedi account, you can also (finally) follow Ohm news over there: hachyderm.io/@ohmjs
hachyderm.io
Ohm.js (@ohmjs@hachyderm.io)
2 Posts, 0 Following, 1 Follower · A user-friendly parsing toolkit for JavaScript and TypeScript ∙ ohmjs.org
000
OhmJS @ohmjs.org · 12/02/2026
By the way, our posts are now powered by @humanwhocodes.com's fantastic crosspost package: github.com/human...
github.com
GitHub - humanwhocodes/crosspost: A JavaScript utility for posting across multiple social networks at once
A JavaScript utility for posting across multiple social networks at once - humanwhocodes/crosspost
001
OhmJS @ohmjs.org · 12/02/2026
Today we published v17.4.0, with one new feature (`recoverSourceOrder` in /extras) and two small fixes: github.com/ohmjs...
000
OhmJS @ohmjs.org · 14/01/2026
Oh hey, we're in JavaScript Weekly again 😊 javascriptweekly.com/issues/768
Ohm: A Parsing Toolkit for JavaScript and TypeScript — It’s been a few years since we covered this project and it’s come along a lot since. It’s a library for building PEG-based parsers you can use in interpreters, compilers, analysis tools, etc. and you can even play with its grammar online.

Warth, Dubroy, et al.
010
OhmJS @ohmjs.org · 21/12/2025
Published v17.3.0 yesterday, with a couple small improvements to the typings and a bug fix related to matching letters outside the BMP (basic multilingual plane): github.com/ohmjs/ohm/re... Last release of 2025 (hopefully 🤞)…watch for a new major release early next year!
github.com
Release Ohm v17.3.0 · ohmjs/ohm
Browser bundles: ohm.js • ohm.min.js New features [d957ac7] typings: #494 - Typescript MatchResult object incomplete [e1b8225] typings: add FailedMatchResult / SucceededMatchResult [891b6d8] feat:...
000
OhmJS @ohmjs.org · 10/12/2025
Just added an example to the Ohm repo of implementing something like Zed's SumTree. (aka "monoid-cached trees" if you want to sound clever) Full example here: github.com/ohmjs/ohm/bl...
Screenshot of the following code:

// In abstract algebra, a _monoid_ is a set (or a data type) that has
// (a) a "combine" operation that's associative, i.e. (a + b) + c = a + (b + c)
// (b) an identity or neutral element.
// This is our identity element…
const LOC_IDENTITY = {line: 0, col: 0};

// …and this is our "combine" operator.
function sumLocations(a, b) {
  return {
    line: a.line + b.line,
    // If `b` has more than one line, we can ignore `a.col`.
    col: b.line > 0 ? b.col : a.col + b.col,
  };
}

function compareLocations(a, b) {
  return a.line - b.line || a.col - b.col;
}

const semantics = g.createSemantics();

// A helper operation to get the "size" of a node, such that
// endLoc = sumLocations(startLoc, size).
semantics.addAttribute('_size', {
  _default(...children) {
    return children.reduce((acc, node) => sumLocations(acc, node._size), LOC_IDENTITY);
  },
  _terminal() {
    const lines = this.sourceString.split('\n');
    return {
      line: lines.length - 1,
      col: lines.at(-1)?.length || 0,
    };
  },
});
031
Reposted by OhmJS
Julian @j4nk.dev · 13/11/2025
What an amazing essay for everyone with the intention to design a programming language. Also mentioned: @ohmjs.org
131
OhmJS @ohmjs.org · 14/11/2025
TIL about the CSS Custom Highlight API: developer.mozilla.org/en-US/docs/W...
000
Reposted by OhmJS
Thomas Steiner @tomayac.com · 20/10/2025
📢 New #WasmAssembly podcast 🎙️ episode: #WebAssembly from the Ground Up with @dubroy.com and @marianoguerra.org. Learn how they're teaching #Wasm by building a compiler in JavaScript and why writing Wasm by hand is crucial! 🍿 www.youtube.com/watch?v=dRdD... 🎧 wasmassembly.libsyn.com/webassembly-...
youtube.com
WebAssembly from the Ground Up with Patrick Dubroy and Mariano Guerra
YouTube video by Chrome for Developers
1134
OhmJS @ohmjs.org · 17/09/2025
Hey everyone, just FYI: After investigating, we do *not* believe that ohm-js, or any other package under the @ ohmjs namespace, is affected by the Shai-Hulud worm or any of the recent npm supply chain attacks.
032
OhmJS @ohmjs.org · 05/08/2025
Any Ohm fans who want to get a taste of low-level programming? Get 25% off the only book in the world* that will teach you WebAssembly with Ohm! (*So far.)
010
OhmJS @ohmjs.org · 28/07/2025
First new release of Ohm in…eh *pulls at shirt collar* quite a while. v17.2.1 is here…one small l'il feature and a teeny weeny fix: github.com/ohmjs/ohm/re... Also pushed v2.0.1 of @ohm-js/cli.
github.com
Release Ohm v17.2.1 · ohmjs/ohm
Browser bundles: ohm.js • ohm.min.js New features: [456b540]: asIteration() is now support for iter nodes (returns the node itself) Fixes [59b17ec]: Expose Matcher’s grammar prop in TS types
010
Reposted by OhmJS
Alex Warth @alexwarth.bsky.social · 25/07/2025
For more info, see: www.inkandswitch.com/ambsheets/no...
inkandswitch.com
Ambsheets: Spreadsheets for exploring scenarios
Ambsheets is a research project about new kinds of spreadsheets for exploring possibility spaces and making better decisions.
031
Reposted by OhmJS
Patrick Dubroy @dubroy.com · 25/07/2025
Pretty pleased with the ergonomics of the Wasm (macro-)assembler in @ohmjs.org. It's built on the low-level assembler lib we created for @wasmgroundup.com, but has some nice higher-level features, including labeled breaks. I'm particularly proud of the idea to put the block label at the end. 😊
A code screenshot showing a TypeScript/JavaScript function called ⁠wrapTerminalLike that generates WebAssembly (WASM) code. The code contains:  • A function definition that takes a ⁠thunk parameter  • Assembly code generation using an ⁠asm object with methods like ⁠block(), ⁠localSet(), ⁠break(), etc.  • A ⁠break statement that references a label called ⁠'_success' (highlighted with a pink arrow and annotation "This...")  • A label definition for ⁠'_success' at the bottom (highlighted with a red arrow and annotation "...goes here")  • Additional assembly operations like ⁠newTerminalNodeWithSavedPos(), ⁠updateLocalFailurePos(), and ⁠setRet()  The pink annotations with arrows illustrate the control flow relationship between the break statement and its corresponding label, showing how the break jumps to the ⁠'_success' label.
182
OhmJS @ohmjs.org · 17/07/2025
You know about the Ohm Discord, right? Great place to ask questions, get feedback on your grammars, and hang out with the some of the friendliest folks out there. discord.gg/KwxY5gegRQ
discord.gg
Join the Ohm Land Discord Server!
Check out the Ohm Land community on Discord - hang out with 169 other members and enjoy free voice and text chat.
000
OhmJS @ohmjs.org · 14/07/2025
Thanks to a generous contribution from Shopify, we've secured enough funding to make further progress towards production-ready Ohm+WebAssembly support! github.com/ohmjs/ohm/i... Thank you Shopify for funding open source. ❤️
github.com
Production-ready WebAssembly support · Issue #511 · ohmjs/ohm
#503 covers the initial investigation into WebAssembly. Due to funding limitations, that work was scoped to a 6-week effort. This issue is about the next phase: productionizing the current prototyp...
152
OhmJS @ohmjs.org · 10/07/2025
A few different Ink & Switch projects have used Ohm…here's the latest one. From @alexwarth.bsky.social (co-creator of Ohm) and @geoffreylitt.com (who made Wildcard, one of our all-time favourite Ohm-powered projects)
183
OhmJS @ohmjs.org · 23/06/2025
Ever wanted to use Ohm from another language? Go, Python, Rust? See the brand new, experimental support for compiling Ohm grammars to Wasm: github.com/ohmjs/ohm/d... It wasn't the main goal, but it also appears to be a perf win — parsing is about 10x faster on real-world grammars (e.g. ES5).
A couple months ago, I started prototyping a new feature: the ability to compile an Ohm grammar to WebAssembly, so that it can be used from languages other than JS. You can find more background (use cases and implementation details) in #503.  The MVP is complete, and this feature is now available for early testing (with some limitations). We're very interested to get feedback and hear what uses cases people have for this.  Although it wasn't the main motivation for this work, early benchmarks are showing ~10x improvement in parse times. Take this with a grain of salt — since the implementation isn't yet complete, it's hard to know what the final performance will look like. But it looks like this will be a significant performance win for real-world grammars!
142
OhmJS @ohmjs.org · 16/06/2025
One of the biggest production users of Ohm that we know of is Shopify. They used Ohm in the Liquid HTML parser that powers their prettier plugin & VS Code language server — as well as the Shopify Admin's CodeMirror-based editor. www.npmjs.com/package/@sh...
npmjs.com
npm: @shopify/liquid-html-parser
Liquid HTML parser by Shopify. Latest version: 2.8.2, last published: 2 months ago. Start using @shopify/liquid-html-parser in your project by running `npm i @shopify/liquid-html-parser`. There are 8 other projects in the npm registry using @shopify/liquid-html-parser.
094
Reposted by OhmJS
Patrick Dubroy @dubroy.com · 17/05/2025
Working on a cheat sheet for @ohmjs.org grammars. wdyt?
2121
OhmJS @ohmjs.org · 16/05/2025
Making progress on the Wasm implementation — and encountering some interesting challenges!
010
Reposted by OhmJS
Patrick Dubroy @dubroy.com · 02/05/2025
Made some good progress on this! Follow along on the issue if you're interested: github.com/ohmjs/ohm/is...
github.com
WebAssembly support · Issue #503 · ohmjs/ohm
Over the years we've had a few requests for a way to use Ohm from other languages — e.g. #348 mentions Dart, Rust, and Swift. Go and Python have also come up in private discussions. This proposal d...
011
OhmJS @ohmjs.org · 29/04/2025
Hey folks, we had another Cloudflare ⇆ GitHub SSL issue which meant the web site was down for about an hour. Thanks for @onlineornot.com we found out pretty quickly, and it should be fixed now! And we'll be getting rid of Cloudflare so hopefully we'll be rid of this problem for good 🤞
000
Reposted by OhmJS
WebAssembly from the Ground Up @wasmgroundup.com · 29/04/2025
Wondering if the book is *practical*? I'm currently using the helper library extracted from the book for a new @ohmjs.org feature which will allow you to compile Ohm grammars to Wasm. This will make it possible to use Ohm grammars from Go, Python, etc. Details here 👉 github.com/ohmjs/ohm/is...
001
OhmJS @ohmjs.org · 25/04/2025
Excited to kick off some new Ohm work next week — adding the ability to compile an Ohm grammar to WebAssembly. See github.com/ohmjs/ohm/i... if you're interested, and feel free to comment if you have opinions!
github.com
WebAssembly support · Issue #503 · ohmjs/ohm
Over the years we've had a few requests for a way to use Ohm from other languages — e.g. #348 mentions Dart, Rust, and Swift. Go and Python have also come up in private discussions. This propos...
052
OhmJS @ohmjs.org · 12/03/2025
Very cool to learn that Ohm was used to create Gambu-Script, which is used to teach programming to over 90k students in Austria! It's part of SchuBu, a free-to-use digital schoolbook: www.schubu.org/p768/progra...
An illustration explaining computer programming basics titled 'Sequence'. The top contains text explaining that a computer program is a set of instructions. Below is a cartoon illustration showing a purple robot sitting at a computer with a confused green monitor display. The robot is speaking in binary code (shown in a speech bubble), while the monitor shows question marks in a thought bubble. The scene includes bookshelves in the background. The caption reads 'Fig. 1 Learning languages pays off.'An educational diagram explaining loops in programming using GamBu-Script. The image shows text explaining that loops are a way to handle repeated actions in programming, with two syntax examples: 'repeat x seconds [command]' and 'repeat x times [command]'. At the bottom, there's a code example in a red-bordered box showing 'right 100' followed by 'repeat 100 times left 1'.
073
OhmJS @ohmjs.org · 10/03/2025
If you dig Ohm and are interested in WebAssembly, check out this book by @dubroy.com (co-creator of Ohm). You'll learn Wasm (the instruction set and module format) by building a compiler for a small programming language. It's also a great way to learn Ohm!
030
OhmJS @ohmjs.org · 17/02/2025
Anyone catch Ohm in the current edition of JavaScript Weekly? javascriptweekly.com/issues/723
010
OhmJS @ohmjs.org · 29/01/2025
Just been told that ohmjs.org is currently down. Sorry about the disruption! We're working on a fix, but in the meantime, if you need to access the docs you can find them here: github.com/ohmjs/ohm/t...
github.com
ohm/doc at main · ohmjs/ohm
A library and language for building parsers, interpreters, compilers, etc. - ohmjs/ohm
100
Reposted by OhmJS
Alex Warth @alexwarth.bsky.social · 21/01/2025
Constraint-Based Spreadsheet, 2014. An attempt to make spreadsheets more powerful and user-friendly by replacing one-way formulas with multi-way constraints. Check out the source code (@ohmjs.org inside!) and play with the live demo at github.com/harc/constra...
1152
Reposted by OhmJS
Alex Warth @alexwarth.bsky.social · 27/12/2024
If you're a fan of @worrydream.com's Inventing on Principle, check out Seymour, a live programming environment I made with Saketh Kasibatla

harc.github.io/seymour-live...
5418
OhmJS @ohmjs.org · 09/12/2024
Extensible parsers…great idea! 😄 x.com/duckdb/stat...
000
Reposted by OhmJS
Patrick Dubroy @dubroy.com · 07/11/2024
📝 New blog post One way to do applied research → dubroy.com/blog/one-way...
One way to do applied research

In some of the communities I hang around in, there’s a fondness for the kind of industrial research that happened at places like PARC and Bell Labs. Things like Smalltalk, Mesa/Cedar, and Plan 9 not only introduced new ideas but demonstrated them in practical, working systems.

If you want to actually do research like this, how should you go about it?

There are a couple of obvious strategies. One is to look for unsolved problems — say, “addressing the scale-up problem in visual programming”. Another strategy is to solve an old problem with new techniques: “X, with CRDTs”. Both of these lead to something that is obviously novel, but it might not really be useful.

But there’s another strategy, which Alex and I took with Ohm. I don’t think it’s groundbreaking, or even original, but it’s worth talking about because (imo) it’s a less obvious way to do research.
1174
OhmJS @ohmjs.org · 22/11/2024
An unconventional use of Ohm…but rad!
050