3 ms·
>> Perl6\Raku has first class support for BNF grammars built right into the language. > Why would you want that? What benefit is there over having parsers avail
by lizmat 4y ago
>> Perl6\Raku has first class support for BNF grammars built right into the language.
> Why would you want that? What benefit is there over having parsers available as library code?
Because in Raku, grammars are really classes. So you can actually use roles and inheritance to build your grammar. And at the lower level in Raku, rules, tokens and regexes are just executable code (method on the grammar), so you can wrap them if need be. And they have all of the optimization opportunities (such as inlining) as all of the other executable code.