Question

Show that the following grammar is ambiguous. Hint: Show two different leftmost or rightmost derivations for...

Show that the following grammar is ambiguous.

Hint: Show two different leftmost or rightmost derivations for the same string. Equivalently, you can show two different parse trees for the same string.

<expr> ::= <expr> + <expr> | <expr> - <expr> | <expr> * <expr> | <expr> / <expr> | int
int ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

Using this grammar show that ambiguity is not acceptable for programming languages.

Hint: Show that the same expression can be evaluated in different ways depending on the derivation.

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
Show that the following grammar is ambiguous. Hint: Show two different leftmost or rightmost derivations for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT