With Bison, you can do something like this (not quite bison syntax):
myrule: TYPE IDENT {DoSomethingRightAfterIdent($1,$2); } LP more_rules
RP; {DoSomethingAfterEverything($1,$2,$5); }
I.e. you have a chunk of C code that's called in the middle of the
processing of the production. (In the above case right after TYPE
IDENT)
Can you do this with lemon?
I know you can do something like this for other cases,
myrule ::= TYPE(T) IDENT(I) temp LP more_rules(R) RP. {
DoSomethingAfterEverything(T,I,R); }
temp ::= DoSomethingRightAfterIdent(...how would I access TYPE/INDENT
from here..);
but it doesn't quite work for this case...
Any ideas?
/Ludvig