CS453 Intro and PA1 1CS453 Lecture Introduction and PA1 2CS453 Compiler ConstructionInstructor: Michelle [email protected] 227Office hours: Wed 3-4Lab hours: Fri 3-4:30URL: http://www.cs.colostate.edu/~cs453CS453 Lecture Introduction and PA1 3Plan for Today Scanning/Lexing Quiz PA1 - the Visitor Design pattern Motivation– Why study compilers? Programming Assignment Overview– The compiler we will be buildingCS453 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 6Dot output from TestInterpreter> java TestInterpreterThe following program:a := 5 + 3;b := (print(a, a - 1), 10 * a);print(b)has max args of 0 and producesthe output shown below when run: <Interpreter not implementedyet>public voidvisitCompoundStm(CompoundStm s) { s.stm1.accept(this); out.println(“;”);
View Full Document