DOC PREVIEW
UD CISC 672 - Phase 4 : Code Generation

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Phase 4 : Code GenerationProgram.javapublic void cgen(PrintWriter s) {CgenClassTable cct = new CgenClassTable(getClasses(), s);}codeGeneration.CgenClassTable.javaThe following steps are performed in the constructortry {installBasicClasses();installClasses(cls);buildInheritanceTree();code();exitScope();} catch (NoScopePresentException e) {Utilities.fatalError(e);}Generating code for classes•installClasses(cls) would generate the code for all the classes by iterating through all the classes.• code() performs all the data related functions, and the in the last line calls codeMethods()• codeMethods() functioncalls the treeNodes.Method.cgen(…) function, which needs to be implemented by you.treeNodes.Method.cgen(…)• This might look familiar to you now:public void cgen(java.io.PrintWriter str, codeGeneration.CgenNode cls ) {cls.setMethodFormals(formals);expr.cgen(str, cls);}• Implement all cgen(java.io.PrintWriter str, codeGeneration.CgenNode cls) methods in treeNodes.* classesTips:• Look at spim.pdf if you would like to look at the instrction set.• Compare the code generated by the binary and use diff to find places where you might be going


View Full Document

UD CISC 672 - Phase 4 : Code Generation

Documents in this Course
Syllabus

Syllabus

18 pages

Load more
Download Phase 4 : Code Generation
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Phase 4 : Code Generation and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Phase 4 : Code Generation 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?