Ambiguous grammar Guide, Meaning , Facts, Information and Description
In computer science, a grammar is an ambiguous grammar if some string in the language can be generated in more than one way (i.e., it has more more than one parse tree or more than one leftmost derivation). A language is inherently ambiguous if it can only be generated by ambiguous grammars.For programming languages, ambiguous grammars can lead to difficulties for some compilers.
| A | → A + A | | | A | → A − A | |
| → a + A | | | → A + A − A | |||
| → a + A − A | | | → a + A − A | |||
| → a + a − A | | | → a + a − A | |||
| → a + a − a | | | → a + a − a |
Equivalently, it is ambiguous since there are two parse trees for the string a + a − a:
References
Programming Languages: Design and Implementation, T. Pratt, M. Zelkowitz. Prentice Hall, 2001
This is an Article on Ambiguous grammar. Page Contains Information, Facts Details or Explanation Guide About Ambiguous grammar
