Fernando Ferreira wrote:

The reason for my request is that, as bison generates LR parsers, there is no way to, for instance, execute an action before a rule is reduced, only after.

I've never tried an action at the start of a rule, but I'm pretty sure that you can do it. Look up 'embedded actions' in the O'Reilly lex&yacc book, or 3.5.5 'Actions in mid-rule' in the Bison 2.0 manual. It may be difficult to avoid conflicts, though. According to the O'Reilly book, yacc implements embedded actions using the technique described at the end of 3.5.5 ("Another solution is to bury the action inside a nonterminal symbol which serves as a subroutine...").

Evan


_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to