CS301 Fall 1998

Project Part #2: The Parser

Out: Tuesday October 20
Due: Thursday, November 5

 

We move on now to coding the parser for C-. The directions below are meant to help you with the steps you might want to take in implementing the parser.

  1. Create a new directory to include your Parser. Copy over your files from the Scanner directory into this new directory, since you will be using them to continue the construction of your parser. (If you would rather use my sample solutions instead, let me know and will email them to you.) Also, copy any files you may wish to use from TINY's Parser, in case you would like to use them as templates. Modify makefile to help you with compilations.
  2. Meet with your teammate to design a syntax tree structure (node) for C-. The discussion we had on the syntax tree structure of TINY should be helpful here.
  3. Draw on paper the syntax tree for a small C- program, like the one we saw in Fig. 3.9 (p. 138).
  4. Decide whether you want to implement the C- parser using the recursive-descend method or the LL(1) method. Discuss the pros and cons of each method. Write up a paragraph to explan your decision.
  5. In the same meeting, discuss with your teammate whether you would like to work together through the implementation of this phase or if you would rather split the implementation into two pieces of roughly equal length and difficulty. This negotiation you should carry seriously and frankly. It is important that both of you understand what you agreed upon and that you feel it is fair.
  6. Implement and test your code thoroughly. Write sample C- code to test your parser on. Create files that catch every syntax error you can think of. For testing the parser, the C- programs do not need to be semantically correct. Remember that the C- source code file should have the .cm extension.
  7. Make sure you have appropriate comments in your files including header comments describing the name(s) of the file creator/modifier, date of modifications and summary of the file contents and use. When needed, have in-line comments to explain elaborate coding that your instructor or your colleagues might have troubles understand.
  8. Hand in the syntax tree structure, the syntax tree you draw on paper, the implementaton decision paragraph and printouts of your code and your tests.
  9. Party! (again!)

Happy programming!