DOC PREVIEW
CSU CS 453 - CS453 Compiler Construction

This preview shows page 1 out of 2 pages.

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

Unformatted text preview:

CS453 Intro and PA1 1CS453 Lecture Introduction and PA1 2CS453 Compiler ConstructionInstructor: Michelle [email protected] 227Office hours: Mon 3-4Lab hours: Wed 3-4, Thurs 1-2URL: http://www.cs.colostate.edu/~cs453Send around sheet to collect email addresses.CS453 Lecture Introduction and PA1 3Plan for Today Scanning/Lexing “Quiz” Motivation– Why study compilers? Programming Assignment Overview– The interpreter and compiler we will be building Logistics of the course– Syllabus– Discussion sectionCS453 Lecture Introduction and PA1 4Scanning/Lexing Quiz class Driver { public static void main ( String [] id ) { System.out.println( boolean && , new int [3], a.length ); } public int [] foo ( ) { } };CS453 Lecture Introduction and PA1 5Structure of a Typical Compiler“sentences”Synthesisoptimizationcode generationtarget languageIRIR code generationIRAnalysischaracter streamlexical analysis“words”tokenssemantic analysissyntactic analysisASTannotated ASTinterpreterCS453 Intro and PA1 2CS453 Lecture Introduction and PA1 6CS453 Lecture Introduction and PA1 7SVG Renderer<svg xmlns="http://www.w3.org/2000/svg"> <!-- rectangles --> <rect x="20" y=" 20" width="300" height="250" fill="red" /> <rect x="30" y="20" width="300" height="250" fill="blue" /> <rect x = "40" y = "20" width = "300" height = "250" fill="green" /> <!-- white circle on top of rectangles --> <circle cx="120" cy="150" r="60" fill="white" /> <!-- black diagonal line --> <line x1="0" y1="0" x2="300" y2="300" stroke="black" /></svg>CS453 Lecture Introduction and PA1 8Structure of the MiniJava Compiler“sentences”SynthesisoptimizationAssem (MIPS)IR code generationAssem (MIPS)Analysischaracter streamlexical analysis“words”tokenssemantic analysissyntactic analysisASTAST and symbol tablecode genMIPSPA3PA4PA5PA6553CS453 Lecture Introduction and PA1 9Specifying Tokens with JFlex Theory meets practice:– Regular expressions, formallanguages, grammars, parsing… JFlex example input file: package mjparser; import java_cup.runtime.Symbol; %% %line %char %cup %public %eofval{ return new Symbol(sym.EOF, newTokenValue("EOF", yyline,yychar)); %eofval} LETTER=[A-Za-z] DIGIT=[0-9] UNDERSCORE="_" LETT_DIG_UND={LETTER}|{DIGIT}|{UNDERSCORE} ID={LETTER}({LETT_DIG_UND})* %% "&&" { return new Symbol(sym.AND, newTokenValue(yytext(), yyline, yychar)); } "boolean" {return newSymbol(sym.BOOLEAN,... {ID} { return new Symbol(sym.ID, new


View Full Document

CSU CS 453 - CS453 Compiler Construction

Download CS453 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 CS453 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 CS453 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?