Discussion:
Unambiguous grammars
(too old to reply)
Tan Nguyen
2004-07-29 16:21:30 UTC
Permalink
Hello,

Does anyone have any tips for turning an ambiguous grammar into an
unambiguous one? In other words, is there something systematically we can
do or recognize in the grammar that will make it easier to remove the
ambiguity? Thanks.
Nguyen Nguyen
2004-07-29 18:58:23 UTC
Permalink
I do not know of a systematic procedure or algorithm to convert an
ambiguous grammar into an unambiguous one. In many cases, you can just do
it by inspection.

In general, the first step is to recognize where the ambiguity lies. A
grammar is ambiguous if it is both left and right recursive. To make the
grammar unambiguous, remove either left or right recursion. It is often
helpful to write out a few words in the language to make sure your grammar
doesn't miss any special cases.

Nguyen
Post by Tan Nguyen
Hello,
Does anyone have any tips for turning an ambiguous grammar into an
unambiguous one? In other words, is there something systematically we can
do or recognize in the grammar that will make it easier to remove the
ambiguity? Thanks.
Continue reading on narkive:
Loading...