Next: About this document ...
CS 405/505 ASSIGNMENT #2
Due Monday, February 25, 2008
Design and implement a recursive-descent
syntax analyzer for MicroRuby which will parse programs according to
the prescribed grammar and produce a syntax-tree representation of the
input program. This process has the following steps:
- The layout of the parser should conform to the EBNF grammar of MicroRuby
given in Assignment #1.
- The parser should interact with the lexical analyzer
to retrieve tokens as it needs them.
- The parser may terminate execution
if a syntax error is detected, printing a suitable error message.
- If the source program has no syntax errors, the result of the parse
should be a source program listing (e.g., this can be printed by the lexical
analyzer as the program is read) and a syntax tree representation of the
major program units (e.g., each main program and method will have a syntax
tree). For convenience this syntax tree may be output at the point at which
it is generated (i.e., interleaved with the source program listing). Print the
tree in Cambridge Polish prefix notation.
Suggestion: First construct the recursive-descent parser
without syntax-tree construction and once this is working add the syntax tree
construction.
Next: About this document ...
CS405 Grader
2008-02-03