in Theory of Computation
1,450 views
0 votes
0 votes

$G$ is a natural-looking grammar for a fragment of a programming language, but $G$ is ambiguous$.$

  1. Show that $G$ is ambiguous$.$
  2. Give a new unambiguous grammar for the same language$.$
in Theory of Computation
by
1.5k views

1 Answer

0 votes
0 votes

for the string

"if condition then if condition then a:=1 else a:=1" has two different parse trees

so the grammar is ambiguous

This is also called dangling else problem

 

edited by

Related questions