Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Subject: Compiler Construction Note: Kindly do not write the answer on a paper as I want to copy and paste it so I do not
Subject: Compiler Construction
Note: Kindly do not write the answer on a paper as I want to copy and paste it so I do not need to write that again thank you
D: Consider the following Semantic rules: S + id = E; {gen( top.get(id.lezeme) '=' E.addr); } | L = E; { gen(L.array.base '[ L.addr"]' '=' E.addr); } E + E + E2 { E.addr = new Temp(); gen(E.addr '=' E, addr'+' E.addr); } |id { E.addr = top.get(id.lezeme); } IL { E.addr = new Temp(); gen(E.addr'=' Larray.base'l L.addr']); } L id [E] { Larray = top.get(id.leceme); L.type = L.array.type.elem; L.addr = new = new Temp 0; gen(L.addr '=' E.addr '*' L.type.width); } | L [E] {L.array = L1 array; L.type = L type.elem; t = new Temp(); L.addr = new Temp 0); gen(t'=' E.addr'*' L.type.width); gen(L.addr'=' L1.addr '+'t); } Now translate the following assignments: i) y = a[i][j] + b[c[k]][j] ii) y=c[k] + b[ a[c[i]]+2 ]
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