Mini Programming project
Project 2
1 Project Description
Consider the grammar of “mini-language”, provided in file “grammar.txt”, and implement a top- down, predictive, recursive descent parser for it.
The parser should take an input file from the command line. Then it should return true if the input is correct syntactically according to “grammar.txt”.
As soon as a syntax error is encountered the parser should stop (terminate execution) and return the position of the error.
1.1 What to submit?
Please refer to COSC 455 Project 1 and 2 Submission Requirements for complete instructions.
1.2 Test cases
• The parser should return true for all the examples in examples-correct-syntax.zip (after un- zipping).
• The parser should return false for all the examples in examples-incorrect-syntax.zip (after unzipping).
Note: These are just some samples. You must create more test cases to test various parts of your parser.
The parser will be tested with some of these test cases plus some additional inputs.
1.3 Optional
1. You can generate an abstract syntax tree as part of the output, for extra 60 points. The tree can be text-based, as long as proper indentation is used to make the tree readable.
2. You can provide complete error diagnostics for extra 20 points.
Note: There will be no partial credits for these extensions.
1