Course Hero Logo

Automata Unambiguous Grammar - Javatpoint.pdf - Unambiguous...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 2 out of 5 pages.

Unambiguous GrammarA grammar can be unambiguous if the grammar does not contain ambiguity that means if it does notcontain more than one leftmost derivation or more than one rightmost derivation or more than one parsetree for the given input string.To convert ambiguous grammar to unambiguous grammar, we will apply the following rules:1. If the left associative operators (+, -, *, /) are used in the production rule, then apply left recursion in theproduction rule. Left recursion means that the leftmost symbol on the right side is the same as the non-terminal on the left side. For example,X → Xa2. If the right associative operates(^) is used in the production rule then apply right recursion in theproduction rule. Right recursion means that the rightmost symbol on the left side is the same as the non-terminal on the right side. For example,X → aXExample 1:Consider a grammar G is given as follows:S → AB | aaBA → a | AaB → bDetermine whether the grammar G is ambiguous or not. If G is ambiguous, construct an unambiguousgrammar equivalent to G.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 5 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
NoProfessor
Tags

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture