deliverable: comments and desugaringThe following modifications should be made to the compiler. You must document the few lines that need to be changed.C-style commentsThe A- implementation only allows one-line comments such as:// this is a commentIt 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-loopsIt 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:
This means that you should
insert your new alternative in the JOOS grammar for
You should be able to handle things like:
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. |