help-bison
[Top][All Lists]
Advanced

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

Re: merge function called AFTER user actions


From: Joel E. Denny
Subject: Re: merge function called AFTER user actions
Date: Mon, 26 Sep 2005 12:17:12 -0400 (EDT)

On Mon, 26 Sep 2005, Derek M Jones wrote:

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


The merge function's job is to merge the semantic values constructed by the two actions. If it were called before the actions, what would it merge?

My point here is that the current functionality seems natural and necessary for all GLR parsers. Do you disagree?

Ok, so let's change its name.

%premerge  ??
%initmerge ??

This pre-merge user function would be an extra feature. I don't foresee myself using it, so I really can't justify spending my own time implementing it and arguing for its acceptance.

In my case I would have to save all sorts of information in
order to undo the effects of the semantic actions that happen
in both rules are reduced.  It is much simpler to perform a
test (ie, will another rule also be matched for this token
subsequence) in a rule.

Personally, I'd do my best to rework this logic. Evaluate the two possibilities in the two semantic actions, and then select one (or both) of the values in the merge function. That's how bison is intended to work.

Joel




reply via email to

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