Ohm (ohmjs.org) is a parsing toolkit for JavaScript and TypeScript that makes use of PEG grammars. Jeremy (my supervisor) suggested I look at a recent blog post, “Inside Ohm’s PEG-to-Wasm compiler“, which describes recent updates that have made it both faster and much more memory efficient.
Prior to this update, the Ohm toolkit took a similar approach to the PEG level in my toolkit: the rules from a PEG grammar were parsed into an AST, and that was interpreted to provide the parsing functionality. Their new version compiles the grammar to WebAssembly, with each rule being compiled as a function. The new compiled parser is linked with support code written in AssemblyScript, and used to create a wasm module.
I don’t know what the main use cases for Ohm are, but presumably they see speed and memory use as important. For now I’m not focusing on these, because in my test examples these are not an issue, but in future versions (i.e. after my PhD is complete) I might look at using a Virtual Machine approach – i.e. a non-JavaScript equivalent of the Ohm approach.
One thing that reading this paper did remind me of, is that I need to make some notes on Alessandro Warth’s PhD thesis, and I should also read the earlier papers on Ohm, linked at the end of that blog post. I also think I might take some inspiration from the Ohm online editor, to improve better test/demo environment for my tools.