Target Deadline: 1pm, September 17, 2007
You're first assignment is to write a Scanner and Parser for the TL07 language. A BNF grammar and a list of lexical items for the TL07 language is provided. If you wish, you may use an automated tool, such as lex, to create the code for your scanner, but since everything is separated by whitespace, you may find that TL07 it is just as simple to write an ad-hoc scanner by hand.
The TL07 language is intended to be LL(1), and you are required to write, "by hand," a recursive-descent top-down parser for it. Your parser should have one method or function corresponding to each non-terminal in the language's grammar, but you may find that you need to modify the BNF grammar in order to write a backtrack-free parser (have a look at p. 77 in Scott) for ideas of the kinds of modifications you might have to make).
For a lexically or syntactically invalid program, your scanner or parser should output an appropriate error message. For a syntactically valid input program, the your parser should output a Graphviz DOT file containing the program's parse tree. This will allow you to use the Graphviz tools to render and view the parse tree graphically. The output file should have a ".pt1.dot" extensions, so if the input file is "test1.tl07", the output file should be "test1.pt1.dot".
[I deleted paragraph about AST; that is for Part 2.]
You are also required to adequately test your compiler and submit your test cases along with your source code. Testing is important, and some advocates of Test Driven Development go so far as to recommend that you do not write any code without first creating a test case that fails without that code. I may also provide some test cases.
There may need to be corrections, clarifications, or other modifications to these instructions, you are responsible for monitoring the class web site, monitoring your CS account mailboxes, and listening during lecture for announcements related to this assignment.