Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a . Consider the following Semantic rules: Now translate the following assignments: i) y = a [ i ] [ j ] + b [
a. Consider the following Semantic rules: Now translate the following assignments:
i) y = a [ i ] [ j ] + b [ c [ k ] ] [ j ]
ii) y = c [ k ] + b [ a [ c [ i ] ] + 2 ]
B.Grammar:
A B a | c B b | d C b | d C a
B q | | A a C
C f A C B | q
Fill the CLR(1) parsing table with suitable error codes / messages and identify the error in the given input string: c b a f q q a c q
D: Consider the following Semantic rules: S + id = E; {gen( top.get(id.lexeme) '=' E.addr); } | L=E; { gen(L.array.base 'l' L.addr '''=' E.addr); } E + E + E { E.addr = new Temp(); gen(E.addr'=' El addr'+ Ey addr); } id { E.addr = top.get(id.lereme); } IL { E.addr = new Temp(); gen(E.addr '=' Larray.base 'l Laddr '1'); } + id [E] {L.array = top.get(id. lexemne); L.type = L.array.type.elem; L.addr = new Temp(); gen(L.addr'=' E.addr'*' L.type. width); } | L[E] {L.array = L aray; L.type = Lj.type.elem; t = new Temp 0); L.addr = = new Temp(); gen(t'= E.addr 's' L.type.width); gen(L.addr'=' Laddr'+'t); } - . . : . D: Consider the following Semantic rules: S + id = E; {gen( top.get(id.lexeme) '=' E.addr); } | L=E; { gen(L.array.base 'l' L.addr '''=' E.addr); } E + E + E { E.addr = new Temp(); gen(E.addr'=' El addr'+ Ey addr); } id { E.addr = top.get(id.lereme); } IL { E.addr = new Temp(); gen(E.addr '=' Larray.base 'l Laddr '1'); } + id [E] {L.array = top.get(id. lexemne); L.type = L.array.type.elem; L.addr = new Temp(); gen(L.addr'=' E.addr'*' L.type. width); } | L[E] {L.array = L aray; L.type = Lj.type.elem; t = new Temp 0); L.addr = = new Temp(); gen(t'= E.addr 's' L.type.width); gen(L.addr'=' Laddr'+'t); }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