The project
Michael's and Laurie's solution is very nice indeed and has received an
excellent grade of A-; however, there is room for improvement, which may
elevate their grade to an amazing A+. This project focuses on four such
improvements.
C-style comments
The A- implementation only allows one-line comments such as:
// this is a comment
I would be nice to additionally allow multi-line comments such as:
/* this is a
somewhat
longer comment */
This improvement can be implemented by only making changes to the
file joos.l .
Increments and for-loops
It would be very nice to include standard increments and for-loops such as:
for (i=0; i<10; i++) k=k*i;
These construct may be introduced as mere syntactic sugar, since
they can readily be expressed in the JOOS language itself.
This improvement can be implemented by only making changes to the
files
joos.l and
joos.y .
More peephole patterns
The peephole optimizer provides a very nice framework, but the
A- implementation only includes four peephole patterns. Surely,
many more can be discovered.
This improvement can be implemented by only making changes to the
file optimize.c .
Correct stack limits
The weakest point of the A- implementation is the stupid computation of
stack limits, which are always assumed to equal 25. It would be much
nicer to compute the exact limit. This improvement can be implemented by only
making changes to the
file emit.c .
|