J. Xue. Tutorials. Tutorials to start in week 3 (i.e., next week) Tutorial questions are already available on-line
|
|
- Georgia Fields
- 5 years ago
- Views:
Transcription
1 Tutorials Tutorials to start in week 3 (i.e., next week) Tutorial questions are already available on-line COMP3131/9102 Page 65 March 4, 2018
2 Assignment 1: Scanner +5 = two tokens: + and 5 the scanner understands how tokens are formed but not anything else COMP3131/9102 Page 66 March 4, 2018
3 COMP3131/9102: Programming Languages and Compilers Jingling Xue School of Computer Science and Engineering The University of New South Wales Sydney, NSW 2052, Australia Jingling Xue COMP3131/9102 Page 67 March 4, 2018
4 NFA REs The Big Picture DFA minimal-state DFA DFA The two conversions in dashed arrows are not covered: REs DFA (pages , Red Dragon/ 3.7, Purple Dragon) DFA REs: Chapter 3, J. Hopcroft, R. Motwani and J. Ullman, Introduction to Automata Theory, Languages, and Computation, Addison-Wesley, 2nd Edition, See www-db.stanford.edu/~ullman/ullman-books.html. DFA minimal-state DFA (pages , Red Dragon/ 3.9.6, Purple Dragon) Tools: COMP3131/9102 Page 68 March 4, 2018
5 Week 2: Regular Expressions, DFA and NFA 1. Definitions of REs, DFA and NFA 2. REs = NFA (Thompson s construction, Algorithm 3.3, Red Dragon/Algorithm 3.23, Purple Dragon) 3. NFA = DFA (subset construction, Algorithm 3.2, Red Dragon/Algorithm 3.20, Purple Dragon) 4. DFA = minimal-state DFA (state minimisation, Algorithm 3.6, Red Dragon/Algorithm 3.39, Purple Dragon) 5. Scanner generators How to use them (straightforward) How to write them (the most techniques introduced today) COMP3131/9102 Page 69 March 4, 2018
6 Applications of Regular Expressions Anywhere when patterns of text need to be specified Specifying restriction enzymes Google analytics Unix system, database and networking administration: grep, fgrep, egrep, sed, awk HTML documents: Javascript and VBScript Perl: J. Friedl, Mastering Regular Expressions, O reilly, 1997 Token Specs for scanner generators (lex, Jflex, etc.) COMP3131/9102 Page 70 March 4, 2018
7 Applications of Finite Automata (i.e., Finite State Machines) Hardware design (minimising states = minimising cost) Language theory Computational complexity Scanner generators (lex and Jflex) Automata tools: downloads/ 39c c-49a3-ac9c-40d807010c07/ COMP3131/9102 Page 71 March 4, 2018
8 Alphabet, Strings and Languages Alphabet denoted Σ: any finite set of symbols The binary alphabet {0,1} (for machine languages) The ASCII alphabet (for high-level languages) String: a finite sequence of symbols drawn from Σ: Length s of a string s: the number of symbols in s ǫ: the empty string ( ǫ = 0) Language: any set of strings overσ; its two special cases: : the empty set {ǫ} COMP3131/9102 Page 72 March 4, 2018
9 Examples of Languages Σ = {0,1} a string is an instruction The set of M68K instructions The set of Pentium instructions The set of MIPS instructions Σ = the ASCII set a string is a program the set of Haskell programs the set of C programs the set of VC programs COMP3131/9102 Page 73 March 4, 2018
10 Terms for Parts of a String (Figure 3.7 of Text) TERM prefix ofs suffix ofs substring ofs proper prefix suffix, substring ofs DEFINITION a string obtained by removing 0 or more trailing symbols ofs a string obtained by removing 0 or more leading symbols ofs a string obtained by deleting a prefix and a suffix from s Any nonempty string x that is, respectively, a prefix, suffix or substring ofssuch that s x COMP3131/9102 Page 74 March 4, 2018
11 String Concatenation If x and y are strings, xy is the string formed by appending y to x Examples: x y xy key word keyword java script javascript ǫ is the identity: ǫx = xǫ = x COMP3131/9102 Page 75 March 4, 2018
12 Operations on Languages (Figure 3.8 of Text) OPERATION DEFINITION union: L M L M = {s s L or s M} concatenation: LM LM = {st s L and t M} Kleene Closure: L L = i=0 Li = L 0 L LL LLL... wherel 0 = {ǫ} (0 or more concatenations of L) Positive Closure: L + L + = i=1 Li = L LL LLL... (1 or more concatenations of L) COMP3131/9102 Page 76 March 4, 2018
13 Examples: Operations on Languages L = {a,...,z,a,...,z, } D = {0,...,9} EXAMPLE LANGUAGE (THE SET OF ) L D L 3 LD L L(L D) D + COMP3131/9102 Page 77 March 4, 2018
14 Examples: Operations on Languages L = {a,...,z,a,...,z, } D = {0,...,9} EXAMPLE LANGUAGE L D letters and digits L 3 all 3-letter strings LD strings consisting of a letter followed by a digit L all strings of letters, including the empty string ǫ L(L D) all strings of letters and digits beginning with a letter D + all strings of one or more digits COMP3131/9102 Page 78 March 4, 2018
15 Regular Expressions (REs) Over Alphabet Σ Inductive Base: 1. ǫ is a RE, denoting the RL {ǫ} 2. a Σ is a RE, denoting the RL {a} Inductive Step: Suppose r and s are REs, denoting the RLsL(r) and L(s). Then (next slide): 1. (r) (s) is a RE, denoting the RL L(r) L(s) 2. (r)(s) is a RE, denoting the RL L(r)L(s) 3. (r) is a RE, denoting the RL L(r) 4. (r) is a RE, denoting the RL L(r) REs define regular languages (RL) or regular sets COMP3131/9102 Page 79 March 4, 2018
16 Precedence and Associativity of Regular Operators Precedence: has the highest precedence Concatenation has the second highest precedence has the lowest precedence Associativity: all are left-associative Example: (a) ((b) (c)) a b c Unnecessary parentheses can be avoided! COMP3131/9102 Page 80 March 4, 2018
17 An Example (Following the Definition of REs) Alphabet: Σ = {0,1} RE: 0(0 1) Question: What is the language defined by the RE? Answer: L(0(0 1) ) = L(0)L((0 1) ) = {0}L(0 1) = {0}(L(0) L(1)) = {0}({0} {1}) = {0}{0,1} = {0}{ǫ,0,1,00,01,10,11,...} = {0,00,01,000,001,010,011,...} The RE describes the set of strings of 0 s and 1 s beginning with a 0. COMP3131/9102 Page 81 March 4, 2018
18 More Example Regular Expressions: Σ = {0, 1} RE 1 {1} 0 1 {0,1} LANGUAGE 1 {ǫ,1,11,111,...} 1 1 {1,11,111,...} the set containing 0 and all strings consisting of zero or more 0 s followed by a 1. COMP3131/9102 Page 82 March 4, 2018
19 Notational Shorthands One or more instances + : r + = rr denotes the language (L(r)) + has the same precedence and associativity as Zero or one instance?: r? = r ǫ denotes the language L(r) {ǫ} written as(r)? to indicate grouping (e.g., (12)?) Character classes: [A Za z ][A Za z0 9 ] COMP3131/9102 Page 83 March 4, 2018
20 Regular Expressions for VC (or C) TOKEN Identifiers Integers digit + Reals RE letter(letter digit) A bit long but can be obtained from the following page by substitutions In the VC spec, letter includes In Java, letters and digits may be drawn from the entire Unicode character set. Examples of identifiers are: abc αβγ COMP3131/9102 Page 84 March 4, 2018
21 Regular Grammars for Integers and Reals in VC Integers: Reals: digit: intliteral: digit + digit: fraction:.digit + exponent: (E e)(+ -)?digit + floatliteral: digit fraction exponent? digit +. digit +.?exponent Regular grammars are a special case of CFGs (Week 3). COMP3131/9102 Page 85 March 4, 2018
22 Finite Automata (or Finite State Machines) A finite automaton consists of a 5-tuple: (Σ,S,T,F,I) where Σ is an alphabet S is a finite set of states T is a state transition function: T : S Σ S F is a finite set of final or accepting states I is the start state: I S. COMP3131/9102 Page 86 March 4, 2018
23 Representation and Acceptance Transition graph: state A transition A a B start state final state start A S Acceptance: A FA accepts an input string x iff there is some path in the transition graph from the start state to some accepting state such that the edge labels spell out x. COMP3131/9102 Page 87 March 4, 2018
24 What Language does this FA accept? start S 1 A COMP3131/9102 Page 88 March 4, 2018
25 Example 1 The language: strings of 0 and 1 with an odd number of 1 (ǫ not included) start 0 S 1 1 A 0 S: even number of 1 s seen A: odd number of 1 s seen Σ {0,1} S {S,A} T T(S,0) = S,T(S,1) = A,T(A,0) = A, T(A,1) = S F {A} I S is recognised because S 0 S 1 A 0 A 1 S 1 A COMP3131/9102 Page 89 March 4, 2018
26 Implicit Error State By definition, T is a function from S Σ tos, but S A start 1 If T(s,a) is undefined at the state s on inputa, then T(s,a) = error S A error start 1 The error state and transitions to it aren t drawn (by convention) COMP3131/9102 Page 90 March 4, 2018
27 Deterministic FA (DFA) and Nondeterministic FA (NFA) A FA is a DFA if no state has an ǫ-transition, i.e., an transition on input ǫ, and for each state s and input symbol a, there is at most one edge labeled a leaving s A FA is an NFA if it is not a DFA: Nondeterministic: can make several parallel transitions on a given input Acceptance: the existence of some path as per Slide 87 COMP3131/9102 Page 91 March 4, 2018
28 DFA or NFA? What are the Languages Recognised? a a a a a start a a a a ǫ ǫ a start a a COMP3131/9102 Page 92 March 4, 2018
29 Two Examples NFA 1: NFA 2: a a a a a start a a a a ǫ ǫ a start a a The same language: the set of all strings of a s such that the length of each of these strings is a multiple of 2 or 3 (ǫ included) COMP3131/9102 Page 93 March 4, 2018
30 Real-Life DFAs The ghosts in Pac-Man have four behaviors: 1. Randomly wander the maze 2. Chase Pac-Man, when he is within line of sight 3. Flee Pac-Man, after Pac-Man has consumed a power pellet 4. Return to the central base to regenerate COMP3131/9102 Page 94 March 4, 2018
31 Real-Life DFAs The behavior of a vending machine: accepts dollars and 25 cents, and charges $1.25 per coke. COMP3131/9102 Page 95 March 4, 2018
32 What About this Non-Real-Life NFA? ǫ COMP3131/9102 Page 96 March 4, 2018
33 Week 2: Regular Expressions, DFA and NFA 1. Definitions of REs, DFA and NFA 2. REs = NFA (Thompson s construction, Algorithm 3.3, Red Dragon/Algorithm 3.23, Purple Dragon) 3. NFA = DFA (subset construction, Algorithm 3.2, Red Dragon/Algorithm 3.20, Purple Dragon) 4. DFA = minimal-state DFA (state minimisation, Algorithm 3.6, Red Dragon/Algorithm 3.39, Purple Dragon) 5. Scanner generators How to use them (straightforward) How to write them (the most techniques introduced today) COMP3131/9102 Page 97 March 4, 2018
34 Thompson s Construction of NFA from REs Syntax-driven Inductive: The cases in the construction of the NFA follow the cases in the definition of REs Important: if a symbol a occurs several times in a RE r, a separate NFA is constructed for each occurrence Thompson s method is one of many available COMP3131/9102 Page 98 March 4, 2018
35 Thompson s Construction Inductive Base: 1. For ǫ, construct the NFA start S ǫ A 2. For a Σ, construct the NFA start S a A Inductive step: suppose N(r) and N(s) are NFAs for REs r and s. Then COMP3131/9102 Page 99 March 4, 2018
36 Thompson s Construction (Cont d) REr s : start S ǫ ǫ N(r) N(s) ǫ ǫ A RE rs : start S N(r) N(s) A ǫ RE r : start S ǫ N(r) ǫ A ǫ RE (r) : N((r)) is the same as N(r) COMP3131/9102 Page 100 March 4, 2018
37 Example: RE = NFA Converting(0 10 1) 10 to an NFA COMP3131/9102 Page 101 March 4, 2018
38 Example: RE = NFA Regular expression: (0 10 1) 10 NFA: ǫ ǫ start ǫ ǫ 0 ǫ ǫ ǫ ǫ ǫ ǫ 9 10 ǫ 15 ǫ 1 ǫ 0 ǫ ǫ ǫ COMP3131/9102 Page 102 March 4, 2018
39 Week 2: Regular Expressions, DFA and NFA 1. Definitions of REs, DFA and NFA 2. REs = NFA (Thompson s construction, Algorithm 3.3, Red Dragon/Algorithm 3.23, Purple Dragon) 3. NFA = DFA (subset construction, Algorithm 3.2, Red Dragon/Algorithm 3.20, Purple Dragon) 4. DFA = minimal-state DFA (state minimisation, Algorithm 3.6, Red Dragon/Algorithm 3.39, Purple Dragon) 5. Scanner generators How to use them (straightforward) How to write them (the most techniques introduced today) COMP3131/9102 Page 103 March 4, 2018
40 Example: DFA (Cont d) start 0,1,2,5,10 1 6,7,9,11,12, ,2,3,4,5,10 1,2,4,5,10, ,8,9, 12,13,14 0 The algorithm used is known as the subset construction, because a DFA state corresponds to a subset of NFA states There are at most 2 n DFA states, where n is the total number of the NFA states COMP3131/9102 Page 104 March 4, 2018
41 Subset Construction: The Operations Used OPERATION ǫ-closure(s) ǫ-closure(t ) move(t, a) DESCRIPTION Set of NFA states readable from NFA stateson ǫ-transitions Set of NFA states readable from some state s int on ǫ-transitions Set of NFA states to which there is a transition on input a from some statesin T s: a NFA state T : a set of NFA states COMP3131/9102 Page 105 March 4, 2018
42 Subset Construction: The Algorithm Lets 0 be the start state of the NFA; DFAstates contains the only unmarked state ǫ-closure(s 0 ); while there is an unmarked statet in DFAstatesdo begin mark T for each input symbol ado begin U := ǫ-closure(move(t, a)); if U is not in DFAstatesthen Add U as an unmarked state in DFAstates; DFATrans[T,a] := U; end; end; COMP3131/9102 Page 106 March 4, 2018
43 Subset Construction: The Definition of the DFA Let(Σ,S,T,F,s 0 ) be the original NFA. The DFA is: The alphabet: Σ The states: all states in DFAstates The start state: ǫ-closure(s 0 ) The accepting states: all states in DFAstates containing at least one accepting state inf of the NFA The transitions: DFATrans COMP3131/9102 Page 107 March 4, 2018
44 Week 2: Regular Expressions, DFA and NFA 1. Definitions of REs, DFA and NFA 2. REs = NFA (Thompson s construction, Algorithm 3.3, Red Dragon/Algorithm 3.23, Purple Dragon) 3. NFA = DFA (subset construction, Algorithm 3.2, Red Dragon/Algorithm 3.20, Purple Dragon) 4. DFA = minimal-state DFA (state minimisation, Algorithm 3.6, Red Dragon/Algorithm 3.39, Purple Dragon) 5. Scanner generators How to use them (straightforward) How to write them (the most techniques introduced today) COMP3131/9102 Page 108 March 4, 2018
45 An Algorithm to Mimimise DFA Statements Initially, let Π be the partition with the two groups: (1) one is the set of all final states (2) the other is the set of all non-final states Let Π new = Π for (each group G in Π new ) { partition G into subgroups such that two states s and t are in the same subgroup iff for all input symbols a, states s and t have transitions on a to states in the same group of Π new replace G in Π new by the set of subgroups formed } Begins with the most optimistic assumption Also used in global value numbering (COMP4133) COMP3131/9102 Page 109 March 4, 2018
46 Example (Cont d): States Re-Labeled start A 0 D 1 0 B E 0 C 0 0 A,D,E start state minimisation 1 B,C 0 1 Theoretical Result: every regular language can be recognised by a minimal-state DFA that is unique up to state names COMP3131/9102 Page 110 March 4, 2018
47 Various Conversions for an Example (0 10 1) 10 NFA in Slide 102 DFA in Slide 110 DFA minimal-state DFA in Slide 110 However, the conversions in dashed arrows are not covered. COMP3131/9102 Page 111 March 4, 2018
48 Week 2: Regular Expressions, DFA and NFA 1. Definitions of REs, DFA and NFA 2. REs = NFA (Thompson s construction, Algorithm 3.3, Red Dragon/Algorithm 3.23, Purple Dragon) 3. NFA = DFA (subset construction, Algorithm 3.2, Red Dragon/Algorithm 3.20, Purple Dragon) 4. DFA = minimal-state DFA (state minimisation, Algorithm 3.6, Red Dragon/Algorithm 3.39, Purple Dragon) 5. Scanner generators How to use them (straightforward) How to write them (the most techniques introduced today) COMP3131/9102 Page 112 March 4, 2018
49 Scanner Generators Scanners generated in C lex (UNIX) flex GNU s fast lex (UNIX) mks lex (MS-DOS and OS/2) Scanners generated in Java Jflex JavaCC (SUN Microsystems) COMP3131/9102 Page 113 March 4, 2018
50 The Scanner Spec in Jflex user code -- copied verbatim to the scanner file %% Jflex directives %% regular expression rules COMP3131/9102 Page 114 March 4, 2018
51 How a Scanner Generator Works Token Spec using REs NFA DFA minimal-state DFA table-driven code (Jflex) simulating a DFA on an input or hard-wired code (Assignment 1 or 3.4 of either Dragon Book) COMP3131/9102 Page 115 March 4, 2018
52 An Example: Spec some user code %% LETTER=[A-Za-z_] DIGIT=[0-9] %% "if" { return new Token(Token.IF, "if", pos); } "<" { return new Token(Token.LT, "<", pos); } "<=" { return new Token(Token.LE, "<=", pos); } {LETTER}({LETTER} {DIGIT})* { return new Token(Token.ID, "itsspelling", pos); } Two rules: The first pattern used when more than one are matched if as a keyword not as an id The longest prefix of the input is always matched <= as one token COMP3131/9102 Page 116 March 4, 2018
53 An Example: NFA N(if) start S ǫ ǫ ǫ ǫ N(<) N(<=) N(id) A DFA can also be used for each pattern. COMP3131/9102 Page 117 March 4, 2018
54 An Example: NFA i f start 0 ǫ ǫ ǫ ǫ 4 < 5 6 < 7 = 8 LETTER 9 10 LETTER, DIGIT COMP3131/9102 Page 118 March 4, 2018
55 DIGIT LETTER but f An Example: DFA f 2, 10 3, 10 LETTER, DIGIT start i < = 5, 7 8 0,1,4,6,9 LETTER but i 10 LETTER, DIGIT Already a minimal-state DFA! COMP3131/9102 Page 119 March 4, 2018
56 A DFA Represented as a Transition Table State Character < = i f LETTER but i LETTER but f DIGIT (0,1,4,6,9) (5,7) (2,10) (10) (2,10) (3,10) (10) (10) (5,7) (8) (8) (10) (10) (10) (10) (10) (10) (3,10) (10) (10) (10) (10) (10) Letter ={i} letter but i Character classes reduce the table size The blank entries are errors The tables are usually sparse (pages of text for compression techniques) COMP3131/9102 Page 120 March 4, 2018
57 The Scanner Driver for Simulating a DFA state = initial_state while (TRUE) { next_state = T[state][current_char]; if (next_state == ERROR) // cannot move any further break; state = next_state; if (current_char == EOF) // input exhausted break; current_char = getchar(); // fetch the next char } Backtrack to the most recent accepting state if (such a state exists) /* return the corresponding token reset current_char to the first after the token */ else lexical_error(state); There should be a column in the transition table for EOF Need to backtrack COMP3131/9102 Page 121 March 4, 2018
58 The Output of Running Jflex on a Sample Scanner Spec Scanner.l: the spec for the scanner generator Jflex jflex Scanner.l Constructing NFA : 267 states in NFA Converting NFA to DFA : 139 states before minimization, 106 states in minimized DFA Old file Scanner.java saved as Scanner.java~ Writing code to Scanner.java Scanner.l.java: the scanner generated javac Scanner.l.java java Scanner < test.vc COMP3131/9102 Page 122 March 4, 2018
59 Limitations of Regular Expressions (or FAs) Cannot count Cannot recognise palindromes (e.g., racecar & rotator) The language of the balanced parentheses is not a regular language {( n ) n n 1} cannot build a FA to recognise the language for any n (can trivially build a FA for n=3, for example) but can be specified by a CFG (Week 3): P (P) () COMP3131/9102 Page 123 March 4, 2018
60 Chomsky s Hierarchy Depending on the form of production α β four types of grammars (and accordingly, languages) are distinguished: GRAMMAR KNOWN AS DEFINITION LANGUAGE MACHINE Type 0 unrestricted grammar α ǫ Type 0 Turing machine Type 1 Type 2 context-sensitive grammar CSGs context-free grammar CFGs α β Type 1 linear bounded automaton A α Type 2 stack automaton Type 3 Regular grammars A w Bw Type 3 finite state automaton COMP3131/9102 Page 124 March 4, 2018
61 Reading Sections of either Dragon Book Week 3 tutorial questions (available on-line) Week 3: Context-Free Grammars COMP3131/9102 Page 125 March 4, 2018
COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou
COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou Administrative! [ALSU03] Chapter 3 - Lexical Analysis Sections 3.1-3.4, 3.6-3.7! Reading for next time [ALSU03] Chapter 3 Copyright (c) 2010 Ioanna
More informationCSEP 501 Compilers. Languages, Automata, Regular Expressions & Scanners Hal Perkins Winter /8/ Hal Perkins & UW CSE B-1
CSEP 501 Compilers Languages, Automata, Regular Expressions & Scanners Hal Perkins Winter 2008 1/8/2008 2002-08 Hal Perkins & UW CSE B-1 Agenda Basic concepts of formal grammars (review) Regular expressions
More informationFinite automata. We have looked at using Lex to build a scanner on the basis of regular expressions.
Finite automata We have looked at using Lex to build a scanner on the basis of regular expressions. Now we begin to consider the results from automata theory that make Lex possible. Recall: An alphabet
More informationLexical Analyzer Scanner
Lexical Analyzer Scanner ASU Textbook Chapter 3.1, 3.3, 3.4, 3.6, 3.7, 3.5 Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Main tasks Read the input characters and produce
More informationLexical Analyzer Scanner
Lexical Analyzer Scanner ASU Textbook Chapter 3.1, 3.3, 3.4, 3.6, 3.7, 3.5 Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Main tasks Read the input characters and produce
More informationCompiler phases. Non-tokens
Compiler phases Compiler Construction Scanning Lexical Analysis source code scanner tokens regular expressions lexical analysis Lennart Andersson parser context free grammar Revision 2011 01 21 parse tree
More informationFormal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata
Formal Languages and Compilers Lecture IV: Regular Languages and Finite Automata Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/
More informationFormal Languages and Compilers Lecture VI: Lexical Analysis
Formal Languages and Compilers Lecture VI: Lexical Analysis Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/ artale/ Formal
More informationLexical Analysis. Prof. James L. Frankel Harvard University
Lexical Analysis Prof. James L. Frankel Harvard University Version of 5:37 PM 30-Jan-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights reserved. Regular Expression Notation We will develop a
More informationConcepts Introduced in Chapter 3. Lexical Analysis. Lexical Analysis Terms. Attributes for Tokens
Concepts Introduced in Chapter 3 Lexical Analysis Regular Expressions (REs) Nondeterministic Finite Automata (NFA) Converting an RE to an NFA Deterministic Finite Automatic (DFA) Lexical Analysis Why separate
More informationLexical Analysis. Chapter 1, Section Chapter 3, Section 3.1, 3.3, 3.4, 3.5 JFlex Manual
Lexical Analysis Chapter 1, Section 1.2.1 Chapter 3, Section 3.1, 3.3, 3.4, 3.5 JFlex Manual Inside the Compiler: Front End Lexical analyzer (aka scanner) Converts ASCII or Unicode to a stream of tokens
More informationCSE 413 Programming Languages & Implementation. Hal Perkins Autumn 2012 Grammars, Scanners & Regular Expressions
CSE 413 Programming Languages & Implementation Hal Perkins Autumn 2012 Grammars, Scanners & Regular Expressions 1 Agenda Overview of language recognizers Basic concepts of formal grammars Scanner Theory
More informationCS308 Compiler Principles Lexical Analyzer Li Jiang
CS308 Lexical Analyzer Li Jiang Department of Computer Science and Engineering Shanghai Jiao Tong University Content: Outline Basic concepts: pattern, lexeme, and token. Operations on languages, and regular
More information2010: Compilers REVIEW: REGULAR EXPRESSIONS HOW TO USE REGULAR EXPRESSIONS
2010: Compilers Lexical Analysis: Finite State Automata Dr. Licia Capra UCL/CS REVIEW: REGULAR EXPRESSIONS a Character in A Empty string R S Alternation (either R or S) RS Concatenation (R followed by
More informationLexical Analysis. Lexical analysis is the first phase of compilation: The file is converted from ASCII to tokens. It must be fast!
Lexical Analysis Lexical analysis is the first phase of compilation: The file is converted from ASCII to tokens. It must be fast! Compiler Passes Analysis of input program (front-end) character stream
More informationChapter 4. Lexical analysis. Concepts. Lexical scanning Regular expressions DFAs and FSAs Lex. Lexical analysis in perspective
Chapter 4 Lexical analysis Lexical scanning Regular expressions DFAs and FSAs Lex Concepts CMSC 331, Some material 1998 by Addison Wesley Longman, Inc. 1 CMSC 331, Some material 1998 by Addison Wesley
More informationLanguages, Automata, Regular Expressions & Scanners. Winter /8/ Hal Perkins & UW CSE B-1
CSE 401 Compilers Languages, Automata, Regular Expressions & Scanners Hal Perkins Winter 2010 1/8/2010 2002-10 Hal Perkins & UW CSE B-1 Agenda Quick review of basic concepts of formal grammars Regular
More informationLexical Analysis. Chapter 2
Lexical Analysis Chapter 2 1 Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexers Regular expressions Examples
More informationLast lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions
Last lecture CMSC330 Finite Automata Languages Sets of strings Operations on languages Regular expressions Constants Operators Precedence 1 2 Finite automata States Transitions Examples Types This lecture
More informationLexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata
Lexical Analysis Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata Phase Ordering of Front-Ends Lexical analysis (lexer) Break input string
More informationZhizheng Zhang. Southeast University
Zhizheng Zhang Southeast University 2016/10/5 Lexical Analysis 1 1. The Role of Lexical Analyzer 2016/10/5 Lexical Analysis 2 2016/10/5 Lexical Analysis 3 Example. position = initial + rate * 60 2016/10/5
More informationCSc 453 Lexical Analysis (Scanning)
CSc 453 Lexical Analysis (Scanning) Saumya Debray The University of Arizona Tucson Overview source program lexical analyzer (scanner) tokens syntax analyzer (parser) symbol table manager Main task: to
More informationConcepts. Lexical scanning Regular expressions DFAs and FSAs Lex. Lexical analysis in perspective
Concepts Lexical scanning Regular expressions DFAs and FSAs Lex CMSC 331, Some material 1998 by Addison Wesley Longman, Inc. 1 CMSC 331, Some material 1998 by Addison Wesley Longman, Inc. 2 Lexical analysis
More information2. Lexical Analysis! Prof. O. Nierstrasz!
2. Lexical Analysis! Prof. O. Nierstrasz! Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.! http://www.cs.ucla.edu/~palsberg/! http://www.cs.purdue.edu/homes/hosking/!
More informationLexical Analysis (ASU Ch 3, Fig 3.1)
Lexical Analysis (ASU Ch 3, Fig 3.1) Implementation by hand automatically ((F)Lex) Lex generates a finite automaton recogniser uses regular expressions Tasks remove white space (ws) display source program
More informationLexical Analysis. Lecture 3-4
Lexical Analysis Lecture 3-4 Notes by G. Necula, with additions by P. Hilfinger Prof. Hilfinger CS 164 Lecture 3-4 1 Administrivia I suggest you start looking at Python (see link on class home page). Please
More informationUNIT -2 LEXICAL ANALYSIS
OVER VIEW OF LEXICAL ANALYSIS UNIT -2 LEXICAL ANALYSIS o To identify the tokens we need some method of describing the possible tokens that can appear in the input stream. For this purpose we introduce
More informationLexical Analysis. Lecture 2-4
Lexical Analysis Lecture 2-4 Notes by G. Necula, with additions by P. Hilfinger Prof. Hilfinger CS 164 Lecture 2 1 Administrivia Moving to 60 Evans on Wednesday HW1 available Pyth manual available on line.
More informationRegular Expressions. Agenda for Today. Grammar for a Tiny Language. Programming Language Specifications
Agenda for Today Regular Expressions CSE 413, Autumn 2005 Programming Languages Basic concepts of formal grammars Regular expressions Lexical specification of programming languages Using finite automata
More informationCSE 413 Programming Languages & Implementation. Hal Perkins Winter 2019 Grammars, Scanners & Regular Expressions
CSE 413 Programming Languages & Implementation Hal Perkins Winter 2019 Grammars, Scanners & Regular Expressions 1 Agenda Overview of language recognizers Basic concepts of formal grammars Scanner Theory
More informationFront End: Lexical Analysis. The Structure of a Compiler
Front End: Lexical Analysis The Structure of a Compiler Constructing a Lexical Analyser By hand: Identify lexemes in input and return tokens Automatically: Lexical-Analyser generator We will learn about
More informationECS 120 Lesson 7 Regular Expressions, Pt. 1
ECS 120 Lesson 7 Regular Expressions, Pt. 1 Oliver Kreylos Friday, April 13th, 2001 1 Outline Thus far, we have been discussing one way to specify a (regular) language: Giving a machine that reads a word
More informationCSE 401/M501 Compilers
CSE 401/M501 Compilers Languages, Automata, Regular Expressions & Scanners Hal Perkins Spring 2018 UW CSE 401/M501 Spring 2018 B-1 Administrivia No sections this week Read: textbook ch. 1 and sec. 2.1-2.4
More informationFigure 2.1: Role of Lexical Analyzer
Chapter 2 Lexical Analysis Lexical analysis or scanning is the process which reads the stream of characters making up the source program from left-to-right and groups them into tokens. The lexical analyzer
More informationAlternation. Kleene Closure. Definition of Regular Expressions
Alternation Small finite sets are conveniently represented by listing their elements. Parentheses delimit expressions, and, the alternation operator, separates alternatives. For example, D, the set of
More informationCSE302: Compiler Design
CSE302: Compiler Design Instructor: Dr. Liang Cheng Department of Computer Science and Engineering P.C. Rossin College of Engineering & Applied Science Lehigh University February 13, 2007 Outline Recap
More informationLanguages and Compilers
Principles of Software Engineering and Operational Systems Languages and Compilers SDAGE: Level I 2012-13 3. Formal Languages, Grammars and Automata Dr Valery Adzhiev vadzhiev@bournemouth.ac.uk Office:
More informationCOMP3131/9102: Programming Languages and Compilers
COMP3131/9102: Programming Languages and Compilers Jingling Xue School of Computer Science and Engineering The University of New South Wales Sydney, NSW 2052, Australia http://www.cse.unsw.edu.au/~cs3131
More informationAbout the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design
i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target
More informationFormal Languages and Grammars. Chapter 2: Sections 2.1 and 2.2
Formal Languages and Grammars Chapter 2: Sections 2.1 and 2.2 Formal Languages Basis for the design and implementation of programming languages Alphabet: finite set Σ of symbols String: finite sequence
More informationLexical Analysis. Introduction
Lexical Analysis Introduction Copyright 2015, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California have explicit permission to make copies
More informationLexical Analysis - 2
Lexical Analysis - 2 More regular expressions Finite Automata NFAs and DFAs Scanners JLex - a scanner generator 1 Regular Expressions in JLex Symbol - Meaning. Matches a single character (not newline)
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Sipser Ch 1.2, 1.3 Design NFA recognizing a given language Convert an NFA (with or without
More informationLexical Analysis/Scanning
Compiler Design 1 Lexical Analysis/Scanning Compiler Design 2 Input and Output The input is a stream of characters (ASCII codes) of the source program. The output is a stream of tokens or symbols corresponding
More informationCS415 Compilers. Lexical Analysis
CS415 Compilers Lexical Analysis These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Lecture 7 1 Announcements First project and second homework
More informationCompiler course. Chapter 3 Lexical Analysis
Compiler course Chapter 3 Lexical Analysis 1 A. A. Pourhaji Kazem, Spring 2009 Outline Role of lexical analyzer Specification of tokens Recognition of tokens Lexical analyzer generator Finite automata
More informationImplementation of Lexical Analysis
Implementation of Lexical Analysis Outline Specifying lexical structure using regular expressions Finite automata Deterministic Finite Automata (DFAs) Non-deterministic Finite Automata (NFAs) Implementation
More informationDavid Griol Barres Computer Science Department Carlos III University of Madrid Leganés (Spain)
David Griol Barres dgriol@inf.uc3m.es Computer Science Department Carlos III University of Madrid Leganés (Spain) OUTLINE Introduction: Definitions The role of the Lexical Analyzer Scanner Implementation
More informationLexical Analysis. Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP 412 at Rice.
Lexical Analysis Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP 412 at Rice. Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved.
More informationThe Front End. The purpose of the front end is to deal with the input language. Perform a membership test: code source language?
The Front End Source code Front End IR Back End Machine code Errors The purpose of the front end is to deal with the input language Perform a membership test: code source language? Is the program well-formed
More informationComputer Science Department Carlos III University of Madrid Leganés (Spain) David Griol Barres
Computer Science Department Carlos III University of Madrid Leganés (Spain) David Griol Barres dgriol@inf.uc3m.es Introduction: Definitions Lexical analysis or scanning: To read from left-to-right a source
More informationChapter 3 Lexical Analysis
Chapter 3 Lexical Analysis Outline Role of lexical analyzer Specification of tokens Recognition of tokens Lexical analyzer generator Finite automata Design of lexical analyzer generator The role of lexical
More informationChapter Seven: Regular Expressions. Formal Language, chapter 7, slide 1
Chapter Seven: Regular Expressions Formal Language, chapter 7, slide The first time a young student sees the mathematical constant π, it looks like just one more school artifact: one more arbitrary symbol
More informationAutomata & languages. A primer on the Theory of Computation. The imitation game (2014) Benedict Cumberbatch Alan Turing ( ) Laurent Vanbever
Automata & languages A primer on the Theory of Computation The imitation game (24) Benedict Cumberbatch Alan Turing (92-954) Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) September, 2 27 Brief CV
More informationUNIT II LEXICAL ANALYSIS
UNIT II LEXICAL ANALYSIS 2 Marks 1. What are the issues in lexical analysis? Simpler design Compiler efficiency is improved Compiler portability is enhanced. 2. Define patterns/lexeme/tokens? This set
More informationImplementation of Lexical Analysis
Implementation of Lexical Analysis Lecture 4 (Modified by Professor Vijay Ganesh) Tips on Building Large Systems KISS (Keep It Simple, Stupid!) Don t optimize prematurely Design systems that can be tested
More informationCS Lecture 2. The Front End. Lecture 2 Lexical Analysis
CS 1622 Lecture 2 Lexical Analysis CS 1622 Lecture 2 1 Lecture 2 Review of last lecture and finish up overview The first compiler phase: lexical analysis Reading: Chapter 2 in text (by 1/18) CS 1622 Lecture
More informationImplementation of Lexical Analysis
Implementation of Lexical Analysis Outline Specifying lexical structure using regular expressions Finite automata Deterministic Finite Automata (DFAs) Non-deterministic Finite Automata (NFAs) Implementation
More informationCSCI312 Principles of Programming Languages!
CSCI312 Principles of Programming Languages!! Chapter 3 Regular Expression and Lexer Xu Liu Recap! Copyright 2006 The McGraw-Hill Companies, Inc. Clite: Lexical Syntax! Input: a stream of characters from
More informationFAdo: Interactive Tools for Learning Formal Computational Models
FAdo: Interactive Tools for Learning Formal Computational Models Rogério Reis Nelma Moreira DCC-FC& LIACC, Universidade do Porto R. do Campo Alegre 823, 4150 Porto, Portugal {rvr,nam}@ncc.up.pt Abstract
More informationLexical Analysis. Implementation: Finite Automata
Lexical Analysis Implementation: Finite Automata Outline Specifying lexical structure using regular expressions Finite automata Deterministic Finite Automata (DFAs) Non-deterministic Finite Automata (NFAs)
More informationAdministrivia. Lexical Analysis. Lecture 2-4. Outline. The Structure of a Compiler. Informal sketch of lexical analysis. Issues in lexical analysis
dministrivia Lexical nalysis Lecture 2-4 Notes by G. Necula, with additions by P. Hilfinger Moving to 6 Evans on Wednesday HW available Pyth manual available on line. Please log into your account and electronically
More informationTheory of Computation
Theory of Computation For Computer Science & Information Technology By www.thegateacademy.com Syllabus Syllabus for Theory of Computation Regular Expressions and Finite Automata, Context-Free Grammar s
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Conceptual Structure of a Compiler Source code x1 := y2
More informationCOMPILER DESIGN UNIT I LEXICAL ANALYSIS. Translator: It is a program that translates one language to another Language.
UNIT I LEXICAL ANALYSIS Translator: It is a program that translates one language to another Language. Source Code Translator Target Code 1. INTRODUCTION TO LANGUAGE PROCESSING The Language Processing System
More informationCompiler Construction LECTURE # 3
Compiler Construction LECTURE # 3 The Course Course Code: CS-4141 Course Title: Compiler Construction Instructor: JAWAD AHMAD Email Address: jawadahmad@uoslahore.edu.pk Web Address: http://csandituoslahore.weebly.com/cc.html
More informationNon-deterministic Finite Automata (NFA)
Non-deterministic Finite Automata (NFA) CAN have transitions on the same input to different states Can include a ε or λ transition (i.e. move to new state without reading input) Often easier to design
More informationCS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 3
CS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 3 CS 536 Spring 2015 1 Scanning A scanner transforms a character stream into a token stream. A scanner is sometimes
More information[Lexical Analysis] Bikash Balami
1 [Lexical Analysis] Compiler Design and Construction (CSc 352) Compiled By Central Department of Computer Science and Information Technology (CDCSIT) Tribhuvan University, Kirtipur Kathmandu, Nepal 2
More informationCS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 2: Lexical Analysis 23 Jan 08
CS412/413 Introduction to Compilers Tim Teitelbaum Lecture 2: Lexical Analysis 23 Jan 08 Outline Review compiler structure What is lexical analysis? Writing a lexer Specifying tokens: regular expressions
More informationDecision, Computation and Language
Decision, Computation and Language Regular Expressions Dr. Muhammad S Khan (mskhan@liv.ac.uk) Ashton Building, Room G22 http://www.csc.liv.ac.uk/~khan/comp218 Regular expressions M S Khan (Univ. of Liverpool)
More informationTheory of Programming Languages COMP360
Theory of Programming Languages COMP360 Sometimes it is the people no one imagines anything of, who do the things that no one can imagine Alan Turing What can be computed? Before people even built computers,
More informationCS 301. Lecture 05 Applications of Regular Languages. Stephen Checkoway. January 31, 2018
CS 301 Lecture 05 Applications of Regular Languages Stephen Checkoway January 31, 2018 1 / 17 Characterizing regular languages The following four statements about the language A are equivalent The language
More informationFinite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur
Finite Automata Dr. Nadeem Akhtar Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur PhD Laboratory IRISA-UBS University of South Brittany European University
More informationThe Language for Specifying Lexical Analyzer
The Language for Specifying Lexical Analyzer We shall now study how to build a lexical analyzer from a specification of tokens in the form of a list of regular expressions The discussion centers around
More informationLexical Analysis 1 / 52
Lexical Analysis 1 / 52 Outline 1 Scanning Tokens 2 Regular Expresssions 3 Finite State Automata 4 Non-deterministic (NFA) Versus Deterministic Finite State Automata (DFA) 5 Regular Expresssions to NFA
More informationInterpreter. Scanner. Parser. Tree Walker. read. request token. send token. send AST I/O. Console
Scanning 1 read Interpreter Scanner request token Parser send token Console I/O send AST Tree Walker 2 Scanner This process is known as: Scanning, lexing (lexical analysis), and tokenizing This is the
More informationCompiler Design. 2. Regular Expressions & Finite State Automata (FSA) Kanat Bolazar January 21, 2010
Compiler Design. Regular Expressions & Finite State Automata (FSA) Kanat Bolazar January 1, 010 Contents In these slides we will see 1.Introduction, Concepts and Notations.Regular Expressions, Regular
More informationFinite Automata and Scanners
Finite Automata and Scanners A finite automaton (FA) can be used to recognize the tokens specified by a regular expression. FAs are simple, idealized computers that recognize strings belonging to regular
More informationDr. D.M. Akbar Hussain
1 2 Compiler Construction F6S Lecture - 2 1 3 4 Compiler Construction F6S Lecture - 2 2 5 #include.. #include main() { char in; in = getch ( ); if ( isalpha (in) ) in = getch ( ); else error (); while
More information3.15: Applications of Finite Automata and Regular Expressions. Representing Character Sets and Files
3.15: Applications of Finite Automata and Regular Expressions In this section we consider three applications of the material from Chapter 3: searching for regular expressions in files; lexical analysis;
More information(Refer Slide Time: 0:19)
Theory of Computation. Professor somenath Biswas. Department of Computer Science & Engineering. Indian Institute of Technology, Kanpur. Lecture-15. Decision Problems for Regular Languages. (Refer Slide
More informationOutline. 1 Scanning Tokens. 2 Regular Expresssions. 3 Finite State Automata
Outline 1 2 Regular Expresssions Lexical Analysis 3 Finite State Automata 4 Non-deterministic (NFA) Versus Deterministic Finite State Automata (DFA) 5 Regular Expresssions to NFA 6 NFA to DFA 7 8 JavaCC:
More informationCompiler Construction
Compiler Construction Lecture 2: Lexical Analysis I (Introduction) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://moves.rwth-aachen.de/teaching/ss-14/cc14/
More informationRegular Expressions. Regular Expressions. Regular Languages. Specifying Languages. Regular Expressions. Kleene Star Operation
Another means to describe languages accepted by Finite Automata. In some books, regular languages, by definition, are described using regular. Specifying Languages Recall: how do we specify languages?
More informationLexical Analysis. Sukree Sinthupinyo July Chulalongkorn University
Sukree Sinthupinyo 1 1 Department of Computer Engineering Chulalongkorn University 14 July 2012 Outline Introduction 1 Introduction 2 3 4 Transition Diagrams Learning Objectives Understand definition of
More informationCS 432 Fall Mike Lam, Professor. Finite Automata Conversions and Lexing
CS 432 Fall 2017 Mike Lam, Professor Finite Automata Conversions and Lexing Finite Automata Key result: all of the following have the same expressive power (i.e., they all describe regular languages):
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 11 Ana Bove April 26th 2018 Recap: Regular Languages Decision properties of RL: Is it empty? Does it contain this word? Contains
More informationRegular Languages. MACM 300 Formal Languages and Automata. Formal Languages: Recap. Regular Languages
Regular Languages MACM 3 Formal Languages and Automata Anoop Sarkar http://www.cs.sfu.ca/~anoop The set of regular languages: each element is a regular language Each regular language is an example of a
More informationCOMP Logic for Computer Scientists. Lecture 25
COMP 1002 Logic for Computer Scientists Lecture 25 B 5 2 J Admin stuff Assignment 4 is posted. Due March 23 rd. Monday March 20 th office hours From 2:30pm to 3:30pm I need to attend something 2-2:30pm.
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Sipser Ch 1.2, 1.3 Decide whether or not a string is described by a given regular expression
More informationComplexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np
Chapter 1: Introduction Introduction Purpose of the Theory of Computation: Develop formal mathematical models of computation that reflect real-world computers. Nowadays, the Theory of Computation can be
More informationProgramming Languages (CS 550) Lecture 4 Summary Scanner and Parser Generators. Jeremy R. Johnson
Programming Languages (CS 550) Lecture 4 Summary Scanner and Parser Generators Jeremy R. Johnson 1 Theme We have now seen how to describe syntax using regular expressions and grammars and how to create
More informationPRINCIPLES OF COMPILER DESIGN UNIT II LEXICAL ANALYSIS 2.1 Lexical Analysis - The Role of the Lexical Analyzer
PRINCIPLES OF COMPILER DESIGN UNIT II LEXICAL ANALYSIS 2.1 Lexical Analysis - The Role of the Lexical Analyzer As the first phase of a compiler, the main task of the lexical analyzer is to read the input
More informationCompiler Construction Using
Compiler Construction Using Java, JavaCC, and Yacc ANTHONY J. DOS REIS Stale University ofnew York at New Pallz IEEE computer society WILEY A JOHN WILEY & SONS, INC., PUBLICATION Preface xv Chapter 1 Strings,
More information8 ε. Figure 1: An NFA-ǫ
0 1 2 3 4 a 6 5 7 8 9 10 LECTURE 27 Figure 1: An FA-ǫ 12.1 ǫ Transitions In all automata that we have seen so far, every time that it has to change from one state to another, it must use one input symol.
More information1. INTRODUCTION TO LANGUAGE PROCESSING The Language Processing System can be represented as shown figure below.
UNIT I Translator: It is a program that translates one language to another Language. Examples of translator are compiler, assembler, interpreter, linker, loader and preprocessor. Source Code Translator
More informationCompilers CS S-01 Compiler Basics & Lexical Analysis
Compilers CS414-2017S-01 Compiler Basics & Lexical Analysis David Galles Department of Computer Science University of San Francisco 01-0: Syllabus Office Hours Course Text Prerequisites Test Dates & Testing
More informationOutline CS4120/4121. Compilation in a Nutshell 1. Administration. Introduction to Compilers Andrew Myers. HW1 out later today due next Monday.
CS4120/4121 Introduction to Compilers Andrew Myers Lecture 2: Lexical Analysis 31 August 2009 Outline Administration Compilation in a nutshell (or two) What is lexical analysis? Writing a lexer Specifying
More informationAnnouncements! P1 part 1 due next Tuesday P1 part 2 due next Friday
Announcements! P1 part 1 due next Tuesday P1 part 2 due next Friday 1 Finite-state machines CS 536 Last time! A compiler is a recognizer of language S (Source) a translator from S to T (Target) a program
More information