help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature request


From: Evan Lavelle
Subject: Re: Feature request
Date: Wed, 20 Jun 2007 19:47:22 +0100
User-agent: Thunderbird 1.5.0.12 (Windows/20070509)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]