Consider the grammar G2 that is shown below: G2: ::= | ::= cat | dog |
Posted: Mon Jun 06, 2022 4:53 pm
Consider the grammar G2 that is shown below:
G2: <pet> ::= <mammal> |
<reptile>
<mammal> ::= cat | dog |
<empty>
<reptile> ::= turtle | snake |
<empty>
Using the grammar given above, answer the following
questions:
(5 points) Show that the above grammar is
ambiguous.
(5 points) Give an unambiguous grammar for the same
language generated by the grammar above.
Posted: Mon Jun 06, 2022 4:53 pm
Consider the grammar G2 that is shown below:
G2: <pet> ::= <mammal> |
<reptile>
<mammal> ::= cat | dog |
<empty>
<reptile> ::= turtle | snake |
<empty>
Using the grammar given above, answer the following
questions:
(5 points) Show that the above grammar is
ambiguous.
(5 points) Give an unambiguous grammar for the same
language generated by the grammar above.
G2: <pet> ::= <mammal> |
<reptile>
<mammal> ::= cat | dog |
<empty>
<reptile> ::= turtle | snake |
<empty>
Using the grammar given above, answer the following
questions:
(5 points) Show that the above grammar is
ambiguous.
(5 points) Give an unambiguous grammar for the same
language generated by the grammar above.