Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the translation of Fig. 6.43, translate each of the following expressions. Show the true and false lists for each subexpression. You may assume the
Using the translation of Fig. 6.43, translate each of the following expressions. Show the true and false lists for each subexpression. You may assume the address of the first instruction generated is 100.
a) a==b kk (c==d |I e==f)
b) (a==b I I c==d) || e==f
c) (a==b && c==d) kk e==f
Fig. 6.43
BBi I MB. B Bi kk M B B! Bi (Bi) Bi.falselist; } 5) B Ei rel E B.truelist makelist(nextinstr); B.falselist makelist(nextinstr + 1); emit(f Ei.addr rel.op E.addr 'goto'); e7m('goto');} B > true ( B.truelist makelist(nextinstr): emit('goto): 1 B> false makelist(nextinstr); emit('goto'); } M e {M.instr nextinstr.) Fi gure 6.43: Translation scheme for boolean expressions backpatch(Bi.falselist, M.instr); B.truelist merge(B truelist, B.truelist); B falselist; } B.falselist {backpatch(Bi.truelist, M.instr); B.truelist; B.truelist B.falselist merge(Bi.falselist, B.falselist); 7 B.truelist B\falselist; B.falselist Bi.truelist; } 1 B.truelist = B.truelist; B.falselist 1 ( B.falselist
Step by Step Solution
There are 3 Steps involved in it
Step: 1
For each expression we generate code for the subexpressions and then for the entire expression For s...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