Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. Consider the grammar: SuSedAAFAnsShFfBBBbBkSg 4.1. What are FIRST (FAn),FIRST(sSh) and FIRST() ? Answer format FIRST(FAn)={}FIRST(sSh)={}FIRST()={} 4.2. Show that the conditions for the existence of
4. Consider the grammar: SuSedAAFAnsShFfBBBbBkSg 4.1. What are FIRST (FAn),FIRST(sSh) and FIRST() ? Answer format FIRST(FAn)={}FIRST(sSh)={}FIRST()={} 4.2. Show that the conditions for the existence of a recursive descent predictive parser hold for the rules of A. This is asking you to only check the conditions for A and not for other non-terminals. 4.3. Write parse_SO. Answer format To keep the code compact, write your conditionals in the form if (t=t1t2t3){}. So, instead of writing write if (t=abcd) \} 4.4. Write parse_AO. 4.5. Give a full execution trace for your parser from part 3.2 above on input udbh The trace should show the correct sequence of calls including calls to the function parse _BO that you were not asked to write. The trace should show the sequence of function calls like parse XO where X is a non-terminal and expect(ttype), where ttype is a token type as well as calls to peek() calls and the values they return. Answer format see old homework solution for answer format Your parse functions should follow the general model of predictive parser that we saw in class. In particular, for non-terminals that can generate , the parser should check the FOLLOW set before choosing to parse the righthand side that generates
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started