D
Diphay Z
The triangle compiler, which was described in the "Programming
Language Processors In Java" --by Watt & Brown. Could anybody discuss
with me?
One of my exercise needs me to extend the compiler to support the
following statement:
for I from E1 to E2 do C, where I is an identifier, E1 and E2 are
expressions will be evaluated as integers, C is a command.
The difficult part of this expansion was in the code generator part.
This statement is hard to formulate a template.
e.g.
For a while command: while E do C
the template can be written as follows:
JUMP h
g: excute C
h: evaluate E
JUMP(1) g
but for the ForCommand, I cannot find out a method to formulate its
template. Anybody can help me? Thanks a lot
Language Processors In Java" --by Watt & Brown. Could anybody discuss
with me?
One of my exercise needs me to extend the compiler to support the
following statement:
for I from E1 to E2 do C, where I is an identifier, E1 and E2 are
expressions will be evaluated as integers, C is a command.
The difficult part of this expansion was in the code generator part.
This statement is hard to formulate a template.
e.g.
For a while command: while E do C
the template can be written as follows:
JUMP h
g: excute C
h: evaluate E
JUMP(1) g
but for the ForCommand, I cannot find out a method to formulate its
template. Anybody can help me? Thanks a lot