/    /  Compiler Design-Handling Ambiguous Grammar

Handling Ambiguous Grammar

 

As we have seen various parsing methods in which if at all the grammar is ambiguous, then it creates the conflict and we cannot parse the input string with such ambiguous grammar.

 

But for some languages in which arithmetic expressions are given, ambiguous grammar is more compact and provides more natural specification as compared to equivalent unambiguous grammar.

 

Secondly, using ambiguous grammar we can add any new special constructs. While using ambiguous grammar for parsing the input.

 

Reference Link

Handling Ambiguous Grammar