in reply to •Re: Macros in a RecDescent grammar
in thread Macros in a RecDescent grammar

I'm currently doing something like that, though I'm not actually updating $text:
macro: identifier ":" expr { if (defined $_macro{$item[2]->getVal()}) { # ERROR -- duplicate macro definitions } else { $_macro{$item[2]->getVal()} = $item[4]; $return = $item[2]; } }
Rather than update $text, I build my op-tree branch directly from expr. (And it's working so far...)
Adding arg's to this seems harder, since the instantiation-points can be many subrules deeper.
- Jim