The Gateway to Computer Science Excellence
0 votes

Write L-attributed SDD's analogous to that of Example $5.19$ for the following productions, each of which represents a familiar flow-of-control construct, as in the programming language C. You may need to generate a three  address statement to jump to a particular label $L$, in which case you should generate goto $L$. 

  1. $S\rightarrow f (C) S_{1}\:else\:S_{2}$
  2. $S\rightarrow do\:S_{1}\: while\:(C)$
  3. $S\rightarrow '\{'L'\}';\:L\rightarrow LS\mid \epsilon$

Note that any statement in the list can have a jump from its middle to the next statement, so it is not sufficient simply to generate code for each statement in order. 

in Compiler Design by Veteran (59.3k points) | 9 views

Please log in or register to answer this question.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,382 answers
105,323 users