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: Satya Kiran
Subject: Re: Reducing conflict: Was: Exceeded limits of %dprec/%merge?
Date: Fri, 19 May 2006 11:57:57 -0500

Sorry for a small digression, but are we moving toward implementing
probablistic CFGs in bison? or is my understanding very oblique..
thanks!

./satya

On 5/19/06, Joel E. Denny <address@hidden> wrote:
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


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





reply via email to

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