For example:
The x+y*z is interpreted as
(x+y)*z
by this grammar (if we use leftmost derivations) and as
x+(y*z)
by G1 or G2.
That is, both G1 and G2 grammar handle the operator precedence correctly (since * has higher precedence than +), while the G3 grammar does not.
In next post, I will explain the most interesting part of context free grammars that is ambiguous grammar.
Monday, July 9, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment