METHOD:
The program in the jflexdemo
folder of the
JFlex2.zip archive (which
we've discussed in class) should help you get started. It
already handles some of the tokens needed for the Gustave language.
It is your job to remove tokens which are not in Gustave and add
those which are.
Your scanner should definitely handle all Gustave keywords, punctuation, numeric literals, and ID's. It should skip over comments and white-space.
Handling string literals correctly will be harder, so I would suggest adding those after everything else is working. You'll probably want to use the start states to handle strings. Remember the start states are described in the JFlex manual.
Notice that once you start using states, you'll want <YYINITIAL> in front of every pattern which you had before you added states.
HAND-IN:
You should submit all source files needed and a makefile to build
your scanner and test driver. This particularly includes the Gustave.flex
file, but should include any other files (e.g. Main.java
, perhaps
a .cup
file to generate sym.java
, etc.) required
to compile and run your scanner.