Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( 3 0 pt ) Consider a language where assignments can appear in the same context as expressions; the value of a = b =

(30pt) Consider a language where assignments can appear in the same context as expressions; the value
of a=b=c equals the value of c. The following grammar, G, generates such expressions that includes
assignments in addition to additions and multiplications:
(a)(3pt) Show a parse tree for the string: id =id**(id =id+id**id.
(b)(10pt) For each production Alongrightarrow, compute FIRST() and FOLLOW(A) using the algorithm below;
FIRST () is computed by string_FIRST (). For each token added, indicate the pair (step, prod) used
to add it, where 0 step 3 is the step in the algorithm (marked as 0,1,2,3 below) and
0prod9 is the production involved; indicate (0,-) when step 0 is used for terminals.
(c)(5pt) For each production i,1i9, compute PREDICT(i).
(d)(2pt) Using the information computed above, show that this grammar is not LL(1).(See definition
on the slide 19 of the LR-parsing chapter.)
(e)(10pt) Modify this grammar to make it LL(1). Explain clearly your changes and prove it is LL(1).
image text in transcribed

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions