logoalt Hacker News

e12e • yesterday at 9:48 PM • 2 replies • view on HN

I'd like to see a bit more about how compares to peg or something like ohm/ometa - am I correct assuming you pretty much give up the benefits of a readable grammar as documentation?

Maybe I just need to see something super simple like a calculator with expressions side by side to grasp the trade-off?

https://ohmjs.org/


Replies

vinipsmaker • today at 2:36 AM

> am I correct assuming you pretty much give up the benefits of a readable grammar as documentation?

This is more of a question language than a parser language. If you have a language that requires a Turing-complete parser than you gave up on grammar. You can use Pratt to parse languages that have grammars.

The language that I'm implementing has procedural macros (hence the parser is Turing-complete). However it has some "structure" that I can port to a tree-sitter parser. The tree-sitter parser for my language won't be 100% accurate, but it'll capture the most important structures.

➕ show 1 reply