(none)

Due: October 5

UNDER CONSTRUCTION!

Objectives

In this course you will be developing an interpretor for a high-level
language, called HL, which manipulates numbers and polynomials

In this assignment you will be using JavaCC to build HL's scanner.

This should familiarize you with the use of compiler generators
and the scanning process.

Preliminary Work

Before you start your assignment,
you will need to set up the environment under which you will be working.
You can develop your assignment on whatever platform you prefer.
However, we will only test it on the moons,
so you should verify your work on this platform before submitting it in order not to lose grades for
compilation problems.
In all cases, you will need to do the following:

The makefile will link your assignment with
TestHL.java.
This program is a fairly standard main file to test javacc scanners.
Do not modify this file as we will be using the one posted here to test and grade your scanner.

If you are developing in UNIX on the command line,
you can use the makefile to recompile and test your scanner.
You will need to modify it though when you add the two new classes.
If you are working in an IDE, you will need to set it up yourself.
You may want to look at the makefile for the sequence of actions and flags.

Compile everything (make will do this if you are working in UNIX on the command line) once to make sure that your compilation settings are correct. This will also generate additional files that you can modify later

Assignment

Once you have set up the environment, and verified that it runs smoothly,
you can start your assignment.

Testing your Assignment

Upload your HL.jj, Token.java, BooleanToken.java,IntegerToken.java, DecimalToken.java, and StringToken.java to elara in a new directory on the moons.

run make in that directory to check that your program compiles properly.

Once it compiles properly,

copy the 2 scripts in the Handouts directory to your source directory and
change their perms to make them executable.
runtests runs all the tests in order.
and t runs one test at a time. Take a look at runtests to see how to use t.

create a subdirectory of your source directory called "Test" and copy all the files in this
Test directory into your Test subdirectory.

Each test is called testX.hl where X is the type of token being tested.

The file containing the expected result for testX.hl is called X.results

Run runtests. If your program passes a test, you will only see the name of that test.
If it doesn't, you will see all the cases where your result differs from the expected result.
You can then fix your program and retest it for that specific test using the script t.

Submitting your Assignment

Once you have verified that your source does compile and run properly on elara:

zip up your
HL.jj, Token.java, BooleanToken.java,IntegerToken.java, DecimalToken.java, IdentifirToken.java and StringToken.java files into a file called A1.zip

References

Explanations
The following provide overviews of scanning with Javacc and are good places to get started because they have enough information to help you produce
a very basic JavaCC file that detects the simple tokens and skips whitespace.