[Various musings, some half-baked, about Ohm-JS and PEG…]

IMO, the best way to start with Ohm-JS is by using the Ohm Editor.

I wrote a small intro to the Ohm Editor, and, I wrote down my train-of-thoughts as I learned Ohm-JS (I chose to transpile a Scheme library to JS to get a js-prolog).

Ohm Editor
Ohm In Small Steps

I wrote these a long time ago and my writing style has changed (I hope that it has become “simpler”).

IMO, the best way to develop a language is:
1) create the grammar with the Ohm-Editor
1a) Test the grammar using the Ohm-Editor and various language snippets.
2) Write an identity transform (input->parser->output, same output as input).
3) Modify the identity transform to suit your needs.

I modified the sample Ohm grammar (Arithmetic) to create transpilers for WASM, Python, JS and Lisp:

WASM Prototype

Python, JS, Lisp Prototypes

Other stuff, maybe of interest:

PEG Cheat Sheet
Racket PEG
PEG vs Other Pattern Matchers
What If Making A Compiler Was Easy?
Glue tool

See Also