This idea took shape this night, while I was sleeping. It's about allowing to plug parser backends into the very perl interpreter. I'm writing it down here because I will not have time to work on it before my vacation. It's simple :
- Compile a perl with some option -DPARSER_PLUGINS to get the support code, which will, hopefully, be simple and short
- The parser plugin is in some module Perl5::Parser::Foo -- one sub per grammar rule
- There's a new pragma use parser qw(Foo) that loads and enables this parser
plugin -- it sets $^H{parser} to "Perl5::Parser::Foo" (as it uses %^H it has block-scoped semantics)
- Each time the yacc parser reduces, it checks $^H{parser} for existence -- if it's here, it
calls the corresponding method on it.
KISS.