deliverable: comments and desugaring
The following modifications should be made to the
compiler. You must document the few lines that need to be changed.
C-style comments
The A- implementation only allows one-line comments such as:
// this is a comment
It 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 .
Please note that you do not have to add the postincrement instruction
in its full generality. You only need to allow statement expressions
of the form: identifier ++ .
This means that you should
insert your new alternative in the JOOS grammar for statementexpression
. Examples that are allowed in Java, but not
required for your A+ JOOS are:
if (x++ == 1) .... or o.f(x++) .
You should be able to handle things like:
y = 3; y++; or for(i=0; i < n; i++)
You should hand in your assignment by making a directory called XXJOOSparser,
where XX is your group number.
Put files which you have modified ,
and a README file describing what you have
done in that directory. Move to the directory containing your XXJOOSparser
directory and create a jar file using jar -cvf groupXX.jar XXJOOSparser
. The jar file should be sent by
e-mail, as an attachment, to your TA. Use the subject heading: "CS 520 - Group xx - Comments and Desugaring", where xx is your group number.
A hard copy, clearly printed and labeled with your group number should
be handed in at the beginning of class.
|