

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Project; Professor: Li; Class: LANG COMPILER DESIGN; Subject: Computer Science; University: Portland State University; Term: Summer 2001;
Typology: Study Guides, Projects, Research
1 / 2
This page cannot be seen from the preview
Don't miss anything!


CS322 Winter’09: Languages and Compiler Design II 01/08/ Prof. Jingke Li (FAB 120-06, [email protected]), Classes: TTh 2-3:50pm, URBAN 304, Office Hours: TTh 10-11am.
This project is to implement a first version of an IR code generator for the MINI compiler. The target IR is the IR tree language discussed in class. The generator is to be implemented as a visitor to the MINI AST nodes. The visitor interface is defined in TransVI.java in the ast subdirectory. When the visitor IrgenVisitor1 is invoked on a MINI AST Program node, an IR tree rooted at a PROG node should be generated. The following is a guide on how to translate specific AST nodes. Since this is a first version of the IR code generator, some nodes’ translations are simplified.
Merge the two STMTlists and create a FUNC node. (The list classes in our IR tree are defined as extensions of Java’s Vector class, hence the method addAll could be used to merge two lists.) The FUNC’s label field gets the Method’s name. Its two other fields, varCnt and argCnt, are not used in this project, and hence should be set to 0s.
A tar file, proj1-code.tar, can be downloaded from the class webpage, which contains
Create a proj1 directory, and untar the tar file there. You are to write a program, IrgenVisitor1.java, and place it in the irgen subdirectory.
Submit your program IrgenVisitor1.java to [email protected]. Please keep a copy of your submitted file aside, in case there is a need for re-submission.