456 views
0 votes
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. 

Please log in or register to answer this question.

Related questions

1 votes
1 votes
1 answer
4