I have a homework assignment, in which i'm supposed to detect ambiguities in a statement, given the grammar in which the statement is defined.
Example:
Grammar: S -> S + S | S * S | id
Statement: id * id + id
The above statement is ambiguous because two parse trees are possible.
I have the following ambiguities in mind as of now:
1) Operator precedence (example above) 2) If-else dangling case 3) Infinite loop (example above is left recursive) 4) Associativity
Could you tell me any more which would be doable?
I have to design this parser using lex and bison (yacc), and submit it in 2 days, so any pointers would be helpful on the ambiguities in the grammar and in the statement.