DOC PREVIEW
CSU CS 453 - Study Guide

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 NFAs and DFAs 1Prelude Other uses of compiler technology– Used in CS410 to parse graphics model– Used frequently throughout career to embed languages withinapplications– domain-specific XML Notice also that ...– JLex is also a compiler– I wonder how it parses its input? Did it use a parser generator?CS453 Lecture NFAs and DFAs 2Plan for Today Previously ...– Tokens can be expressed to the lexer generator JLex as regular expressions How do lexer generators work?– Convert regular expressions to NFA– Converting an NFA to DFA– Implementing the DFACS453 Lecture NFAs and DFAs 3Structure of the MiniJava Compiler“sentences”SynthesisoptimizationAssem (MIPS)IR code generationAssem (MIPS)Analysischaracter streamlexical analysis“words”tokenssemantic analysissyntactic analysisASTAST and symbol tablecode genMIPSPA3PA4PA5PA6553CS453 Lecture NFAs and DFAs 4Specifying Tokens with JFlex 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 ...CS453 Intro and PA1 2CS453 Lecture NFAs and DFAs 5Example NFA for Multiple TokensCS453 Lecture NFAs and DFAs 6DFA from IF and ID


View Full Document

CSU CS 453 - Study Guide

Download Study Guide
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 Study Guide 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 Study Guide 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?