Your program must be written in plain C (not C++) and use bison to generate the parser. You must have a Makefile such that when you type make, all the pieces are compiled and result in a binary program called cflat. make clean should also delete all temporary files, so that the program can be made again from scratch.
Your program will be invoked as follows:
./cflat -parse sourcefile.cflatIf the input has valid C-flat syntax, then you should output nothing and exit with status 0 to indicate success. If the input does not parse correctly, then you must emit parse error: followed by a reasonable error message (see the yyerror routine) and exit with status 1. In the input does not scan correctly, then you must emit scan error: followed by a reasonable error message and exit with status 1. If your program is invoked with the -scan flag, then it must function correctly according to the Scanner Assigment. If your previous assignment had some bugs, then it is your responsibility to fix them.
Note that Bison will tell you if your grammar has errors. In particular, your grammar must not have any shift-reduce or reduce-reduce conflicts. To eliminate them, you may only re-write the production rules, you may not apply disambiguating rules or apply other "tricks" found in Bison. The purpose of this rule is to force you to understand the limitations of the LALR(1) grammar class.
A compiler has many odd corner cases that you must carefully handle. You must test your program extensively by designing and testing a large number of test cases. To encourage you to test thoroughly, we will also require you to turn in ten testing input files. Five should be named good[1-5].cflat and should be valid C-flat programs. Five should be named bad[1-5].cflat and should contain at least one parse error.
For this assignment, your grade will be based upon the following:
To turn in the assignment, copy your source files, Makefile, and testing files into your dropbox directory, which is:
/afs/nd.edu/coursefa.08/cse/cse40243.1/dropbox/YOURNAME/parser