DOC PREVIEW
UD CISC 672 - Advanced Compiler Construction

This preview shows page 1-2-3-18-19-36-37-38 out of 38 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 38 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 38 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 38 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 38 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 38 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 38 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 38 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 38 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 38 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CISC 672 – Advanced Compiler ConstructionTimo K¨otzingSeptember 9, 2008DisclaimerThe following does not describe the cool-language in depth. It isnot designed to be used as a syntax reference, but rather as anintroduction into programming with cool, and also into objectoriented programming in general.For the purpose of writing your own cool-compiler, please read thecool-manual carefully.Timo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Program?Ia cool-program is a list of cool-classesIclasses may be spread over several filesIone of the classes has to be named “Main”Ithis class has to contain a method named “main”Iexecuting a cool-program is equivalent to evaluating this“Main.main()” functionTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Program?Ia cool-program is a list of cool-classesIclasses may be spread over several filesIone of the classes has to be named “Main”Ithis class has to contain a method named “main”Iexecuting a cool-program is equivalent to evaluating this“Main.main()” functionTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Program?Ia cool-program is a list of cool-classesIclasses may be spread over several filesIone of the classes has to be named “Main”Ithis class has to contain a method named “main”Iexecuting a cool-program is equivalent to evaluating this“Main.main()” functionTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Program?Ia cool-program is a list of cool-classesIclasses may be spread over several filesIone of the classes has to be named “Main”Ithis class has to contain a method named “main”Iexecuting a cool-program is equivalent to evaluating this“Main.main()” functionTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Program?Ia cool-program is a list of cool-classesIclasses may be spread over several filesIone of the classes has to be named “Main”Ithis class has to contain a method named “main”Iexecuting a cool-program is equivalent to evaluating this“Main.main()” functionTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Program?Ia cool-program is a list of cool-classesIclasses may be spread over several filesIone of the classes has to be named “Main”Ithis class has to contain a method named “main”Iexecuting a cool-program is equivalent to evaluating this“Main.main()” functionTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Class?Ia cool-class is a list of featuresIfeatures are either attributes or methodsIattributes are local variables (with scope of the class)Imethods are global functions, addressed by“< functionName > . < methodName > (...)”Iattributes have to have a type and may be initializedImethods have a (possibly empty) list of formal parameters, areturn type and a bodyTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Class?Ia cool-class is a list of featuresIfeatures are either attributes or methodsIattributes are local variables (with scope of the class)Imethods are global functions, addressed by“< functionName > . < methodName > (...)”Iattributes have to have a type and may be initializedImethods have a (possibly empty) list of formal parameters, areturn type and a bodyTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Class?Ia cool-class is a list of featuresIfeatures are either attributes or methodsIattributes are local variables (with scope of the class)Imethods are global functions, addressed by“< functionName > . < methodName > (...)”Iattributes have to have a type and may be initializedImethods have a (possibly empty) list of formal parameters, areturn type and a bodyTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Class?Ia cool-class is a list of featuresIfeatures are either attributes or methodsIattributes are local variables (with scope of the class)Imethods are global functions, addressed by“< functionName > . < methodName > (...)”Iattributes have to have a type and may be initializedImethods have a (possibly empty) list of formal parameters, areturn type and a bodyTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Class?Ia cool-class is a list of featuresIfeatures are either attributes or methodsIattributes are local variables (with scope of the class)Imethods are global functions, addressed by“< functionName > . < methodName > (...)”Iattributes have to have a type and may be initializedImethods have a (possibly empty) list of formal parameters, areturn type and a bodyTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Class?Ia cool-class is a list of featuresIfeatures are either attributes or methodsIattributes are local variables (with scope of the class)Imethods are global functions, addressed by“< functionName > . < methodName > (...)”Iattributes have to have a type and may be initializedImethods have a (possibly empty) list of formal parameters, areturn type and a bodyTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat is a COOL-Class?Ia cool-class is a list of featuresIfeatures are either attributes or methodsIattributes are local variables (with scope of the class)Imethods are global functions, addressed by“< functionName > . < methodName > (...)”Iattributes have to have a type and may be initializedImethods have a (possibly empty) list of formal parameters, areturn type and a bodyTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat are Types in COOL?Ievery class is a typeIthe basic types are the classes “Object”, “IO”, “Int”, “String”and “Bool”Iall classes but Object have to be inherited from exactly oneother class (be a child of this class)Ievery class that does not specify a class to inherit from isinherited from ObjectIthe “is child of”-relation has to be a tree, rooted at ObjectIbasic classes provide several basic functionsI“Int”, “String” and “Bool” may not be inherited fromTimo K¨otzing CISC 672 – Advanced Compiler ConstructionWhat are Types in COOL?Ievery class is a typeIthe basic types are the classes “Object”, “IO”, “Int”, “String”and “Bool”Iall classes but Object have to be inherited from exactly oneother class (be a child of this class)Ievery class that does not specify a class to inherit from isinherited from ObjectIthe “is child of”-relation has to


View Full Document

UD CISC 672 - Advanced Compiler Construction

Documents in this Course
Syllabus

Syllabus

18 pages

Load more
Download Advanced Compiler Construction
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 Advanced Compiler Construction 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 Advanced Compiler Construction 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?