Assignment 1: Lexer

Due: 10 pm, Monday, September 20.

Assignment 1 is to build a lexer for Appel's Tiger language using ML-Lex. The Tiger language is defined in Appendix A of the course textbook. Documentation on ML-Lex is available on the class web page, and also (in less detail) in chapter two of the textbook.

Skeleton files to get you started are available in the $TIGER/chap2/ directory, which you can find at Appel's textbook homepage.

You should submit:

You're expected to write clean code; just getting it to work is not enough.

Your lexer should use the error-reporting machinery in Appel's ErrorMsg module (see file $TIGER/chap2/errormsg.sml), or something equivalent that you write yourself. In particular, error messages should be reported using line-number/column offsets, not by simply specifying the character offset from the beginning of the file.

Words to the wise: Relative to, say, a parser, it's not hard to build a lexer, but:

See the course text for more information, in particular chapter two and appendix A.