In response to various requests I have made the source code for the Parva compiler described in chapter 14 available for people to study and to play with. There is no compulsion to do so, but if you would like to study the code in detail, go right ahead. You will not be expected to answer practical questions on this code in the examination. If we had had another week it might have been a different story!
There are several files zipped up in the file PRAC26.ZIP.
l: md prac26 cd prac26 copy i:\csc301\trans\prac26.zip unzip prac26.zip
This will create several other directories "below" the prac26 directory:
L:\prac26 L:\prac26\coco L:\prac26\frames L:\prac26\Library L:\prac26\Parva
containing the Java classes for the Java version of the Coco/R compiler generator. You will also find various sample programs and grammars, contained in files with extensions like
*.ATG, *.PAV, *.TXT *.BAD
Make the compiler:
CMAKE Parva
Try it out, for example:
PARVA queens.pav
Look at the code in queens.cod in the usual way.
The interpreter in this kit can handle several extended opcodes like LDC_1 or LDGA_1, but the code generator and parser are not set up to do those optimizations (which would, of course take the same sort of form as you are supposed to be developing in Practical 25).
Have fun. Ask me if there is anything you do not understand or would like explained further.