|
|
Micro C Compiler Project
Available information:
- All students will be implementing a small subset of the programming
language C, called Micro-C.
- Graduate students will have to implement
additional constructs.
- The programming project will be subdivided into four parts.
Current assignments are listed below:
-
Part 1.
As an example, I am including a
Lex specification file for a simple desk calculator.
The associated y.tab.h file has been automatically generated by Yacc (using the option -d). Please note that yacc is available in the directory /usr/ccs/bin/ which may be missing from your PATH shell variable.
The wordcount (wc) specification
presented in class is also available. Please, read some hints about using yytext as an external variable.
-
Part 2.a)
As an example, I am including a
YACC specification file for a simple desk calculator, together with the associated
LEX specification, and a simple
main program.
A good discussion of
shift/reducue
and reduce/reduce
conflicts is
included in the Bison manual.
A few hints on providing error recovery in
YACC-generated parsers are also included.
-
Part 2.b)
As an example of using semantic rules in YACC, I am including a
YACC specification file for a simple desk calculator
(including evaluation of expressions), together with the associated
LEX specification, and a simple
main program. You will find additional examples on atlas in my directory: ~kochut/csx570/semant.
I also created pages with additional hints on
implementing symbol tables.and processing function calls.
-
Part 3.
The last programming assignment is to add the intermediate code generation
for the virtual computer called UGAVAC.
The intermediate code generation should be handled according to the
Micro-C code patterns.
Some hints on how to facilitate code generation for
type conversions in passing parameters in
function calls are also provided, including the necessary changes
to the grammar.
I have created a page with a few examples of intermediate code generation for Micro-C.
|