Reference no: EM132464461
CSC 460/660 - Compiler Construction - University of Nevada
The Espresso Compiler Project
• Read and understand the Visitor Pattern. This is very important before you start implementing.
• Read and understand section 3.3 and 3.4. It is important that you understand what scope is and how it works in Espresso.
• Implement the definition pass in the ClassAndMemberFinder.java file.
• Implement the resolution pass in the NameChecker.java file. Make sure you understand the idea behind the use of the field MyDecl. It is used in the following way: Every time we have a use of something we have to look it up in the table structure. If the use is legal the corresponding declaration will be returned from the table look-up. This declaration is what goes into the myDecl field. This way we do not have to look it up next time we need the declaration associated with the use of something; also this means that once this phase is done we can discard of most of the symbol tables (specifically, all the symbol tables created in the resolution pass.)
• Use the build.xml and ant to compile your compiler.
• Use the 'espressoc' script to test your compiler.
• If you wish to compare my output you can use the 'espressocr' script to invoke my reference compiler. Most people find it advantageous to mimic the output of my compiler such that they can use the UNIX utility 'diff' to compare the output from the two compilers.
Obtaining the Handout Code
Use espressou install 3 to install the phase 3 handout code.
Running the Reference Implementation
In order to check your compiler against my version of the Espresso compiler, you can use the espressocr script. That will submit your file to my reference implementation and return the output.
Pre-supplied Code and Testing
The pre-supplied code for this phase is my solution to phase 2 (i.e., CUP and JFlex files that work) plus all the parse tree nodes that you already have.
You will find the SymbolTable.java file, the skeletons for ClassAndMemberFinder.java and NameChecker.java and a Type.java that is used to generate signatures. Visitor.java and PrintVisitor.java are also supplied. When you hand in your project we will use the build.xml file to compile your project, and the espressoc script to run your compiler. If we cannot do that we will not mark your project, i.e., you get 0 on this phase. We will do the following to test your compiler:
ant clean
ant
espressoc <testfile.java>
Attachment:- Compiler Construction.rar