OhmJS

OhmJS

@ohmjs.org

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

90 followers55 following32 posts

OhmJS reposted

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)

Patrick Dubroy@dubroy.com

Also I finally put together a consulting/ page, for anyone who's interested in working with me. dubroy.com/consulting/ Did I mention I still have availability this year? 😇

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...

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.)

We've released a new version of @wasmground/emit — the small, simple #Wasm 1.0 "assembler library" for JS/TS, which we build up piece by piece in our book. The headline feature: proper TypeScript types! Give it a spin and let us know what you think: www.npmjs.com/package/@was...

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.comRelease Ohm v17.3.0 · ohmjs/ohmBrowser bundles: ohm.js • ohm.min.js New features [d957ac7] typings: #494 - Typescript MatchResult object incomplete [e1b8225] typings: add FailedMatchResult / SucceededMatchResult [891b6d8] feat:...

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...

Patrick Dubroy@dubroy.com

Stumbled across it in Raph Levien's resources for learning compute shaders: notes.billmill.org/programming/... Never realized how many things (including a lot of text processing) can be expressed as scan / all-prefix-sums. Eg see "Zed Decoded: Rope & SumTree" zed.dev/blog/zed-dec...

TIL about the CSS Custom Highlight API: developer.mozilla.org/en-US/docs/W...

Mariano Guerra@marianoguerra.org

Performant Syntax highlighting with CSS.highlights API and OhmJs How to generate small & performant syntax highlighting for your languages using OhmJs and the new CSS.highlights API www.youtube.com/watch?v=v3jK... Repo: github.com/marianoguerr... Demo: marianoguerra-atik.github.io/ohm-highlight/

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.

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.)

The summer holidays just started here in southern Germany. So, it's time for a ☀️ SUMMER SALE ☀️ — Use the code SUMMER25 for a 25% discount on the book until Sept 15: wasmgroundup.com

OhmJS reposted

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. 😊

We're still looking for more sponsors! If you or your company can help fund this effort: github.com/sponsors/pd... Since 2017, my work on Ohm has been unpaid. Your sponsorship helps the project be sustainable, ensuring that I can maintain and improve Ohm for many years to come!

github.comSponsor @pdubroy on GitHub SponsorsI'm the lead developer of Ohm (ohmjs.org), a user-friendly parsing toolkit for JavaScript and TypeScript. I also created the Ohm Editor, and the interactive visualization for understanding and ...

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)

Alex Warth@alexwarth.bsky.social

What if a spreadsheet cell could hold multiple values at the same time? That's the idea behind Ambsheets, a project I've been working on w/ @geoffreylitt.com at @inkandswitch.com. It's a new spreadsheet that makes it easier for you to explore many possibilities simultaneously. 1/2

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).

We are seeking funding to make it possible to ship a production-ready version. (It's an estimated 8–10 more weeks of effort.) If you or your company would benefit from the portability and performance improvements and could potentially help fund this work, please get in touch with @dubroy.com!

Outside of this specific funding need, if you get value from Ohm you should consider a recurring sponsorship: github.com/sponsors/pdu... This keeps the project sustainable and ensures that I can continue to spend time maintaining and improving Ohm for everyone!

Making progress on the Wasm implementation — and encountering some interesting challenges!

Patrick Dubroy@dubroy.com

Ok ok this may not make a lot of sense but I am *extremely* happy to have gotten this code working!! So I feel compelled to share. (And yes, I wrote my own macro-assembler for #wasm in JavaScript. That's how much fun I'm having, and yes I mean that sincerely.) 1/x

OhmJS reposted

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 🤞

OhmJS reposted

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...

Patrick Dubroy@dubroy.com

btw what I'm using here is the "assembler library" that we construct bit by bit in @wasmgroundup.com. It's also available as a standalone NPM package: www.npmjs.com/package/@was... There's not yet much documentation (outside of the book), but we'll work on that soon!

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!

Excited to announce the official launch of our online book, WebAssembly from the Ground Up! 🎉 It's the book we wish we'd had 3 years ago. No messing with tools and frameworks. It's a hands-on guide to the core of Wasm: the instruction set and module format. Link below. 👇

An unconventional use of Ohm…but rad!

Geoffrey Litt@geoffreylitt.com

Just made my LLM outputs 2-3x faster by replacing JSON output with a custom DSL syntax 🤓 Only took a few hours to develop the grammar + parser with the Ohm language + IDE... (ohmjs.org)

You are up to date.