Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions