In: Computer Science
Check ambiguity, operators’ precedence and associativity (
2) <E> → id | <E> - id | <E> * id
A grammar is said to ambiguous if for any string generated by it, it produces more than one-
Here 3 parse tree can be generarated by the grammer
as
< E > < E > < E >
| | |
id -id *id
so the grammar is ambiguos
operator precedence
A grammar is said to be operator precedence grammar if it has two properties:
here it have no and no other non terminals
*>-
For an grammar to be associative it should be unambiguos but here the grammar is ambiguos so its not an associative grammar