Statement translation
The assignment, if, while, read and write statements are translated as follows:
|
Assignment |
x := expr |
|
code for expr |
|
Conditional |
if C then |
L1: |
code for C |
|
While-do |
while C do S |
L1: L2: |
code for C |
|
Input |
read X |
|
IN_INT X |
|
Output |
write expr |
|
code for expr |
If the code is placed in an array, then the label addresses must be back-patched into the code when they become available.
Posted in Computer Science, Information Technology, Compiler Design, Compiler Design |
