4. (10 pts) Using the following grammar where <assign> is the start symbol:<?xml
ID: 3548779 • Letter: 4
Question
4. (10 pts) Using the following grammar where <assign> is the start symbol:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
1. <assign> ------> <id> := <expr>
2. <id> ------> A | B | C
3. <expr> ------> <expr> + <term>
4. <expr> ------> <term>
5. <term> ------> <term> * <factor>
6. <term> ------> <factor>
7. <factor> ------> ( <expr> )
8. <factor> ------> <id>
a) Provide the left-most derivation of the sentence: C := (A + C) + B * C (Note: each derivation step MUST be followed by the number of the production rule that made it possible). (6 pts)
b) Provide the parse tree of the derivation in a) above. (4 pts).
Explanation / Answer
The declarations section of the yacc grammar file contains the following:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.