CS453 Intro and PA1 1CS453 Lecture PA4 Intro 1Plan for Today LR parsing as pushdown automata Intro to PA4: Parsing and AST generation– restricted grammar in example code– parse trees versus ASTs– using dot to visualize ASTs Abstract syntax tree construction– building them with nonterminal attributes– examples: Figures 2.39, 5.10, 5.11– variable declarations included?– sequences of statementsCS453 Lecture PA4 Intro 2Example LR Parse Table(1) S -> S ( S )(2) S -> epsilonr1r1r14s4s233r2r2r22accepts211r2r2r20S$)(StateGotoActionCS453 Lecture PA4 Intro 3Pushdown Automata for GrammarCS453 Lecture PA4 Intro 4Structure of the MiniJava Compiler“sentences”SynthesisoptimizationAssem (MIPS)IR code generationAssem (MIPS)Analysischaracter streamlexical analysis“words”tokenssemantic analysissyntactic analysisASTAST and symbol tablecode genMIPSPA3PA4PA5PA6553CS453 Intro and PA1 2CS453 Lecture PA4 Intro 5Abstract Syntax Tree for Memory Layout
View Full Document