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


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

Reply via email to