The translation of the WHILE command

Describe a structure that could be used to represent the abstract syntax tree
April 1, 2023
Programming languages
April 1, 2023

The translation of the WHILE command

Compiler Construction
Outline the key features of the design of the part of a compiler that will translate
the abstract syntax tree representation of a program into a stack-based intermediate
code. Concentrate on those features used in the translation of the following
fragment:

LET i = k
LET j = k
WHILE (i>0) AND (j<100) DO { i := i-1; j := j+2 }

In particular, concentrate on the mechanism you would choose to deal with
(a) the scopes of identifiers [6 marks]
(b) the compilation of boolean expressions involving the operators NOT, AND
and OR [6 marks]
(c) the translation of the WHILE command [4 marks]
(d) the translation of the two assignments [4 marks]