COS 320, Spring 2000. Programming Assignment
Programming Assignment 2: Lexical Analyzer
Further details about this assignment are described in Modern Compiler
Implementation, Chapter 2, pages 31, 32. Please read these
pages. You will also need to refer to the Tiger reference manual in
Appendix A.
Using ml-lex
- Make a new directory as2 for this assignment.
- Copy the files /u/cs320/chap2/*.sml and
/u/cs320/chap2/*.cm into as2.
- Please, familiarize yourself with the code that is already there.
- Run sml and compile the code using
CM.make();
- Directory /u/cs320/testcases contains several
files with sample Tiger code. You can test the parser by running
Parse.parse "filename".
- If you want to test your code with input entered from the command
line, then invoke the parser as
Parse.parse "/dev/tty". In this case you should
press Ctrl-D to indicate the end of the input stream.
- Edit the code in tiger.lex. You will have to
remove some of the sample code and add a lot of your own.
- Recompile, test, debug, edit. Repeat as necessary.
- Submit by submit 2 tiger.lex.