COSC 4400
Assignment #3
Lexical Scanner for Gustave language

Due date: Wednesday, February 27, 2019

GOAL: Use JFlex to write a lexical scanner for the Gustave language described in the Gustave overview, sample program, and Gustave grammar. You'll need to look through the description to identify the various patterns and tokens. Your assignment should include a driver program which prints out the tokens and attributes for an input program (like the JFlex demo we discussed in class).

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.