4 ms·
I think you are reading in too much the criticism of how grammars work. Ultimately the leading compiler uses the Perl 6 grammar engine and tooling to implement
by Ultimatt 9y ago
I think you are reading in too much the criticism of how grammars work. Ultimately the leading compiler uses the Perl 6 grammar engine and tooling to implement the language compiler! So if your needs are substantially less complex than needing to implement your own programming language, say parse some XML or something. Then the grammar engine is more than competent. The authors criticism of how to handle errors during parse and making a really advanced robust parser is definitely fair. However, the technology for doing this in a deep way does exist. It's already found in the grammar debugger module from one of the core devs (https://github.com/jnthn/grammar-debugger https://github.com/jnthn/grammar-debugger). There just isn't perhaps a nicer "user" level API for you handling parsing in a flexible way when something goes wrong. There are mechanisms for making your grammar flexible though such as proto rules/tokens/regexes https://docs.perl6.org/language/grammars#Protoregexes https://docs.perl6.org/language/grammars#Protoregexes here when different options are encountered you can trigger different code to handle whats being parsed.