Stories
Slash Boxes
Comments
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)

Tuesday July 30, 2002
02:10 AM

More on the shadow parser

[ #6739 ]
I worked a bit more on my Perl5::ShadowParser (see this previous entry). I shaped it into a module, with the ability to plug backends in. Backends are modules with a list of methods rule1..rule197 to be triggered by the parser's reduce actions (just like any other LALR parser -- there's precisely 195 grammar rules as of perl 5.8.0) and (here comes the difficult part) a token method to be called each time a token is read. I have to add a constructor as well.

Yes, that's the main difficulty : the tokenizer. I can't always figure out the value of the token returned to the parser (the one declared with %token in the yacc source) or the contents of the input source associated to each non-faked-up token. (The tokenizer sometimes makes up tokens to help the parser. Or it may switch two tokens. I suspect it to cast a spell from time to time.)

OK, if this approach doesn't work, I'll try plan B: patch perl to allow pluggable parser backends.

If strain on the lexer were a design criterion, I blew it long ago. -- Larry Wall

And I should avoid sausage factories.

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