COP 4020 PROGRAMMING LANGUAGES CONCEPTS
Spring 2008
Project: SUBC Parser
DUE: end of the semester
Remember:
* Have your name and UF ID on what you submit
* Submit everything in a single jar or zip file to CourseWorx.
Goals:
The objective of this first project is to implement a lexical analyzer, and a recursive descent parser for a subset of C language called SUBC.
The grammar for the language is here.
You must write your OWN lexical and syntax analyzers in the language of your choice (either C++ or Java).
You are NOT allowed to use 'lex' and 'yacc' or any similar software in order to implement this project.
For lexical analysis, there are many good textbooks that describe how to construct them.
In essence, a lexical analyzer is a Finite-State Automaton. The lexical rules for SUBC is here.
Regarding grading and submission
1. Put in a BUGS file all comments of known errors (if any) of your project.
It is MUCH better for you to list the limitations of your software than to let us discover them.
The more time it takes for us to find what's wrong with your program, the larger the portion of credit WE (and not you) earn.
In short, you must make it easy for us to examine your program.
2. Your output should match the corresponding tree for each one of the test programs.
Please bear with the idiosyncracies of my parser, and match its behavior anyway.
We will provide some sample test programs and their trees after spring break(about 5-10).
3. Grading strategy:
We will run your program on each of the test programs, and we will compare (bit by bit) your AST with the correct one.
Full credit will be given a perfect match in every case. Credit will be lost for failing to follow the above instructions.
Readability and clarity of the source code is also important for your grade.
4. Executable Name: p1. Include a make file in your submission.
You must provide a makefile to build this project. We will compile your program by invoking: make
we will then test p1 by invoking it as follows:
p1 testprog1
p1 testprog2
..
Notice that the input is NOT standard input (stdin), but instead a command-line parameter.
Examples:
p1 -ast tests/Treepicture
5. p1 (without switches) should produce no output whatsoever.
Required switches: -ast This switch prints the abstract syntax tree, and nothing else.
No headers or footers. The AST must match exactly, character for character, the correct one.
6. It must be possible to run p1 from ANY directory: ~user/cop4020/p1 testfile
Here is the link for the sample programs