- #1
SpiffyEh
- 194
- 0
Homework Statement
Consider the following If-Else Grammar:
<stmt> => if <expr> then <stmt>
| if <expr> then <stmt> else <stmt>
| ... (assume other types of <stmt>s, not part of exercise
Show that this grammar is ambiguous.
Homework Equations
The Attempt at a Solution
I don't really understand what ambiguous means, I have the definition
A grammar is ambiguous if and only if it generates two or more distinct parse trees of same type (derivation) for same sentence
But I don't see how this works. Can someone please explain to me how this grammer could generate 2 or more distinct parse trees for the same derivation of a sentence? I just don't see how it could.