Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of rafael (2125)

Friday August 02, 2002
02:33 AM

Random notes about pluggable perl parser backends

[ #6856 ]
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.


The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.