Institutt for Informatikk
Universitetet i Bergen
I 125  Innføring i Programoversettelse
Voluntary Exercise Set 10 (Gruppeøvelser. 10)

Consider the following C expression:
a * b + (5  (1 + 2))

Draw an appropriate AST for the expression,
preferably one that your parser would produce.

Give a sequence of threeaddress instructions corresponding
to the expression and AST.

Give a sequence of Pcode instructions corresponding
to the expression and AST.

Give a sequence of
BVM
instructions corresponding to the expression and AST.

Consider the following C expression:
a[a[i+10]] = b[2+3]

Draw an appropriate AST for the expression,
preferably one that your parser would produce.

Give a sequence of threeaddress instructions corresponding
to the expression and AST.

Give a sequence of Pcode instructions corresponding
to the expression and AST.

Give a sequence of
BVM
instructions corresponding to the expression and AST.

Consider the following C expression:
p>next>next = p>next

Give a sequence of threeaddress instructions corresponding
to the expression.

Give a sequence of Pcode instructions corresponding
to the expression.

Give a sequence of
BVM
instructions corresponding to the expression.

Exercise 8.15 on page 486 of the text.