help-bison
[Top][All Lists]
Advanced

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

Re: Reducing conflict: Was: Exceeded limits of %dprec/%merge?


From: Joel E. Denny
Subject: Re: Reducing conflict: Was: Exceeded limits of %dprec/%merge?
Date: Fri, 19 May 2006 12:34:09 -0400 (EDT)

On Fri, 19 May 2006, Derek M Jones wrote:

> likely; as least I think so until my figures show otherwise;
> which they cannot until I have have access to both parse
> trees when an ambiguity occurs).

If you construct parse trees (a parse forest really) in your semantic 
actions, you will have access to them all in your %merge functions.

> One possible solution would be to allow the grammar writer to
> specify weights for a particular reduction.  When a conflict
> occurred the one with the greatest weight would be chosen.

A conflict action (which we proposed earlier) could be encoded with these 
weights so it could choose a reduction before a split could occur.

> Preferably these weights could change as the parse progressed.
> Using the above example, both id1 and id2 would both initially
> be given the same is_identifier weight.  However, when reduced
> thorough declaration_specifier_list the weights would be changed
> to reflect the fact that the extra information (two ids in sequence)
> indicates that one is a typedef-name and the other an identifier.

Now it's starting to sound like a job for semantic actions and semantic 
values to track the weights.  %merge could ultimately make the choice.

Joel




reply via email to

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