|
|
| Keep It Simple, Stupid | |
| PerlMonks |
Re^3: How does perl's lexer and parser cooperate?by dave_the_m (Parson) |
| on Dec 26, 2012 at 15:54 UTC ( #1010399=note: print w/ replies, xml ) | Need Help?? |
|
It seems GRAMPROG is not the only one that's special, I tried to search other symbols like ADDOP in toke.c but it's never defined to "+" there. where are these terminal symbols finally defined?I think you're misunderstanding how this works. ADDOP (and many of the others) don't correspond to actual terminal symbols like '+'. They are just numerical constants (ADDOP is defined as 305 in perly.h). yylex returns this value for multiple "addish" operator types, such as '+', '-', '.'; with extra info in the ival field indicating what op to use (such as OP_ADD, OP_CONCAT etc). Dave.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||