Question: Consider a language where assignments can appear in the same context as expressions; the value of a = b = c equals the value of
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:
program
exp
exp
term tail
term tail
term
factor tail
factor tail
factor
factor
exp $$
idexp
term term tail term term tail epsi
factor factor tail factor factor tail epsi
exp
id
a Showaparsetreeforthestring: id id id id id id$$
b For each production A alpha compute firstalpha and followA using the algorithm below; firstalpha is computed by string FIRSTalpha For each token added, indicate the pair step prod used toaddit,wherestepisthestepinthealgorithmmarkedas belowand prod is
cpt For each production i i compute predicti
d Using the information computed above, show that this grammar is not LL
e Modify this grammar to make it LL Explain clearly your changes and prove it is LL
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
