No parser generator really follows the theoretical classes (LR, LL, GLR, PEG etc) exactly, but these are still best ways to describe parsing strategy, and you can't ignore which class you have, as each of them forces grammars to be built certain ways, and won't work otherwise. Raku grammars are definitely PEG style, and very far from other parsing styles.
Even the article you linked states "Raku Grammars: Some folk describe Raku Grammars as PEGs". Their counter-argument that Raku supports putting semantic predicates in the grammar is really weird, as most parser generators do, like ANTLR for sure, and even Bison.
The thing about having dedicated TOP rule or not is more a note about API design. LL and PEG style parsers can generally start from any rule. ANTLR 4 doesn't seem to have any way to designate any rule as default TOP rule for more concise API, I think what Raku is doing here with default rule makes sense.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Raku's parsers aren't PEGs. See Comparing/contrasting Raku Grammars and PEGs.
The
TOP
rule is only special in the sense it's the rule called to enter a grammar if you don't specify which rule to start at.You can specify any rule as the parsing entry point. Just pass a
rule => 'rule-name'
argument to a parsing routine.No parser generator really follows the theoretical classes (LR, LL, GLR, PEG etc) exactly, but these are still best ways to describe parsing strategy, and you can't ignore which class you have, as each of them forces grammars to be built certain ways, and won't work otherwise. Raku grammars are definitely PEG style, and very far from other parsing styles.
Even the article you linked states "Raku Grammars: Some folk describe Raku Grammars as PEGs". Their counter-argument that Raku supports putting semantic predicates in the grammar is really weird, as most parser generators do, like ANTLR for sure, and even Bison.
The thing about having dedicated TOP rule or not is more a note about API design. LL and PEG style parsers can generally start from any rule. ANTLR 4 doesn't seem to have any way to designate any rule as default TOP rule for more concise API, I think what Raku is doing here with default rule makes sense.