CSc 453 : Programming Assignment 3 (Type Checking and Semantic Actions)
Start Date: Mon Feb 24 Sat Feb 27, 2016
Due Date: 11:59 PM, Tue March 8, 2016
1. General
This assignment involves augmenting your parser to carry out some
semantic actions, which involve processing declarations and managing
symbol tables; checking type consistency of programs; and constructing
syntax trees. The rules for processing declarations and checking type
consistency are given in the
μC Language Specification.
Your program will silently accept correct inputs, and report error messages
for inputs containing errors.
The exit status of your program should be 0 if no errors are encountered during processing,
and 1 if any errors (including syntax and/or semantic errors) are encountered at any point.
2. Invoking Your Program
Your program will be called compile. It will read all input from stdin,
and report errors to stderr.
3. Turnin
You should turn in the sources to your code on lectura. These should
include:
-
The sources and headers for your scanner and parser. If you use tools
such as lex, yacc, etc., you should turn in the specifications given to these
tools.
-
A main routine that calls your parser.
-
A make file called Makefile that should support at least the following
targets:
-
compile
The command "make compile" should build
your parser from scratch, by invoking
the appropriate tools (flex, bison, etc.)
on their input specifications, and should result in the creation of an
executable file compile that implements the functionality
specified above for this assignment.
-
clean
The command "make clean" should delete
(at least) all software-generated files in the current directory,
including: C source files created by flex/bison,
e.g., y.tab.h, lex.yy.c, y.output,
etc.; object files, *.o; as well as the executable file
compile.
-
Any additional material you wish to turn in. Any documentation or comments
may be turned in in a file README.
To turn in your files, use the command
turnin cs453s16-assg3
file1
file2
...
filen
Turn in the files you want to submit just as they are: don't zip them up
or turn in a directory containing your files.
For more information on the turnin command, try man turnin.
Note: The turnin command copies the files submitted
into another directory. Because of this, programs that use
relative path names in include files and make files (e.g.,
#include "../../foo/bar/baz.h") may not
compile and execute correctly once they are
turned in. Please avoid using relative pathnames.
The output of your program will be compared with the "expected" output using
diff utility (see diff(1)).
With the exception of error messages, your output must follow
the specification exactly.
For this reason it is recommended that you follow
the specification, and instructions for turnin, closely.