I'm most familiar with specifying grammar for the ANTLR tool. Just out of curiosity, is the antlr grammar a parsing expression grammar? Does anyone know?
Separately, I'm curious about how a parser generated out of ANTLR/yacc etc compares to this hand written one? If you've done some benchmarking, it'd be great to see numbers!
At least according to wikipedia, ANTLR accepts a CFG (context free grammar), while PEG (parsing expression grammar) is not context free, specifically, the choice operator in a PEG selects the first match.
I've been reading about parsers recently (https://www.craftinginterpreters.com/contents.html and https://peps.python.org/pep-0617/). It seems like recursive descent parsers are considered a little easier to reason about, and PEG aligns well with recursive descent.
I have not yet dived deeper in yacc, bison, or ANTLR and how you would write a parser from a CFG. Can anyone add their experiences?
Many of them are incomplete, but it gives a good idea of how the grammar looks for ANTLR.
I used the ANTLR grammar for parsing CSS in DiffLens (https://github.com/marketplace/difflens). DiffLens uses the typescript compiler itself to parse TS and JS.
I've also used Roslyn to parse C# (and F#). I wonder if the ruby compiler itself exposes a parser.