DOC PREVIEW
CSU CS 453 - Structure of the Mini Java Compiler

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 Midterm review 1Structure of the MiniJava Compiler“sentences”SynthesisoptimizationAssem (MIPS)IR code generationAssem (MIPS)Analysischaracter streamlexical analysis“words”tokenssemantic analysissyntactic analysisASTAST and symbol tablecode genMIPSPA3PA4PA5PA6553CS453 Lecture Midterm review 2Plan for Today Studying for the midterm– review all slides and notes taken in class– do suggested exercises– redo any examples we did in class– reread assigned reading– the midterm WILL NOT have anything about MIPS Lexical Analysis, or scanning Syntactic Analysis, or parsingCS453 Lecture Midterm review 3Lexical Analysis, or scanning Terminology– regular expressions– tokens– DFA– NFA– longest match and priority Techniques– creating a scanner for a set of tokensCS453 Lecture Midterm review 4Syntactic Analysis, or parsing Terminology– context-free grammars, terminal, non-terminal, symbol, derivation– syntax-directed translation, actions, attributes– LR(0) versus LR(1) grammars– parse trees versus abstract syntax trees– ambiguity– LL(k) and left recursion– top-down and bottom-up parsing– precedence and associativity– pre- and post-order depth-first traversals– error handlingCS453 Intro and PA1 2CS453 Lecture Midterm review 5Syntactic Analysis, or parsing cont... Techniques– rewrite a grammar so that it is LL(1)– calculate FIRST and FOLLOW sets– write a predictive parser with panic mode error handling– disambiguate expression and list grammars– create an LR(0) or LR(1) parse table– parse a string of tokens with an LR parse tableCS453 Lecture Midterm review 6Grammar HierarchyCS453 Lecture Midterm review 7Predictive parser for Float Assignment Grammarvoid S() { switch (lookahead) { case ID: case EOF:// the 2 characters in the FIRST(StmList EOF)try { StmList(); match(EOF); } catch { panic(S); } break; default: panic(S); break;}}void StmList() { switch (lookahead) { case ID: // FIRST( Stm StmList ) = { ID } try { Stm(); StmList(); } catch { panic(StmList) } break; case EOF: // FOLLOW(StmList) = { EOF } break; default: panic(StmList); break;}}void Stm() { switch (lookahead) { case ID: try { match(ID); match(ASSIGN); match(FLOAT); } catch { panic(Stm); } break; default: panic(Stm); break;}}CS453 Lecture Midterm review 8Example LR Parse Table(1) S -> S ( S )(2) S ->


View Full Document

CSU CS 453 - Structure of the Mini Java Compiler

Download Structure of the Mini Java Compiler
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 Structure of the Mini Java Compiler 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 Structure of the Mini Java Compiler 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?