Homework 1: Lexer

Due Tuesday, 29 January 2008, 6 PM

This assignment 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. There is limited documentation for ML-Lex in chapter two of the textbook, so you may also find the complete documentation for ML-Lex useful.

Skeleton files to get you started are available in the $TIGER/chap2/ directory, which you can find on Appel's textbook homepage. The provided sources.cm won't work with SML/NJ 110.67, so you may want to use this one instead.

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.

Caution: Relative to 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.


Last updated 18 February 2008.

Valid XHTML 1.1 Valid CSS!