help-bison
[Top][All Lists]
Advanced

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

merge function called AFTER user actions


From: Derek M Jones
Subject: merge function called AFTER user actions
Date: Fri, 23 Sep 2005 02:33:02 +0100
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

All,

I have finally gotten around to trying to do something
sensible with my C grammar (see discussion during February).
Just to remind you all, %merge was used to disambiguate
situations like:

(x) * y;

ie, is this a cast of *y to type x, or a multiplication of
x by y?

In most cases the expression in ( ) is more complicated
than a single identifier and in this case there is no
ambiguity (the expression is not syntacticly a type).

If I knew in advance (that is, before the action associated
with a rule was executed) I could set some variable that
could be tested in the action to decide whether to handle
the common case or whether some kind of semantic ambiguity
resolution was needed.

Unfortunately the function associated with %merge is called
AFTER the actions are executed.

Looking at the generated parser it seems that simply swapping
around the call to yyresolveAction and yyuserMerge (in yyresolveValue)
would achieve what I want (ie, the call to the %merge function
to occur first).

Does anybody know why the decision was made to have the %merge
function called last?  This choice seems to be very suboptimal.

Being able to specify %merge functions that could be called before
and after would probably please everybody :-)

Attachment: derek.vcf
Description: Vcard


reply via email to

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