Assignment 2: Parser

Due: class time (6 pm), Thursday, February 16.

Project 2 is to build a parser for Appel's Tiger language using ML-Yacc. The Tiger language is defined in Appendix A of the course textbook. Documentation on ML-Yacc is available on the class web page, and also (in less detail) in chapters three and four of the textbook.

Your parser should produce an abstract syntax tree using the datatypes defined in the Absyn structure defined in the file $TIGER/chap4/absyn.sml.

Skeleton files to get you started are available in the $TIGER/chap3/ and $TIGER/chap4/ directories, which you can find at Appel's textbook homepage. In particular, these files will be useful:

Remember to update your file. Be certain to add to it, in addition to any other new files you are using. You'll want to remove tokens.sml from it, because a tokens file will be automatically generated by ml-yacc now. Also, you'll need to update some header information in your lex file - see the end of chapter 3 for details.

You should submit:

Anything subtle about your grammar, such as ambiguity resolutions of various kinds, should be clearly commented. You knew that, of course.

Your parser should use the same error-reporting machinery you employ in your lexer.

Words to the wise:

See the course text for more information, in particular chapters three and four and appendix A.

Good luck; have fun.