Question

Given the following grammar
statement if-stmt | other | Ԑ
if-stmt if (exp) statement else-part
else-part else statement | Ԑ
exp 0 | 1
a) Draw a parse tree for the string
If (0) if (1) other else else other
b) What is the purpose of the two else’s?

1. Given the following grammar (10 Marks) statement- if-stmt other | E if-stmt - if (exp) statement else-part else-part else

I need the the diagram of the parse tree

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PLEASE UPVOTE IF YOU FIND THE SOLUTION USEFUL.

PARSE TREE:

statement if- stint - if I exp . Statement I else-part else else stateme statement -ol if-stat Other if I exp , statement els

The first else refers to the inner if(1) part according to the above parse tree and the outer else with result as other is part of outer if(0) part.

Add a comment
Know the answer?
Add Answer to:
Given the following grammar statement if-stmt | other | Ԑ if-stmt if (exp) statement else-part else-part...
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
ADVERTISEMENT