COP 5621 - Homework 1 - Lexical Analyzer

Due Monday, September 23

Read the description of the Tiger lexical analyzer on pages 34-35. To find out details of Tiger's tokens, you will also need to refer to the Appendix on pages 522-531. You can view the JLex reference manual at http://www.cs.princeton.edu/~appel/modern/java/JLex/.

As mentioned in the syllabus, you need to set some UNIX environment variables to access JLex. Add the following lines to your .cshrc file:

  setenv JAVA_HOME /depot/J2SE-1.4
  setenv CLASSPATH "/homes/smithg/javatools:."

My /homes/smithg/javatools/tiger/chap2 directory contains a number of files to help you; you can copy them to your directory with the command

  cp -rp /homes/smithg/javatools/tiger/chap2 .
The only file that you need to modify is Parse/Tiger.lex, which contains the JLex specification.

Here are a few tips: