Consider the following grammar (A and B are non-terminals)
A → A a | B | B d
B → b d | b
Are there any ambiguities? If so, please give an example.
Considering the grammers,the parse tree of the gramer is as follows,
A → A a | B | B d
B → b d | b
Here ,considering the string "bd",we get two parse tree using this grammer.
since two different parse tree exists,the grammer is ambigious.
A grammer is said to ambiguious ,if there is more than one Left most derivation or more than Right most derivation or more than one parse tree exists.Here the grammer is ambigiuous.
Get Answers For Free
Most questions answered within 1 hours.