Compilers and computer architecture: From strings to ASTs (1): finite state automata for lexing
Martin Berger 1 October 2019
1Email: M.F.Berger@sussex.ac.uk, Office hours: Wed 12-13 in
Chi-2R312
1 / 1
Compilers and computer architecture: From strings to ASTs (1): - - PowerPoint PPT Presentation
Compilers and computer architecture: From strings to ASTs (1): finite state automata for lexing Martin Berger 1 October 2019 1 Email: M.F.Berger@sussex.ac.uk , Office hours: Wed 12-13 in Chi-2R312 1 / 1 Recall the function of compilers 2 / 1
1Email: M.F.Berger@sussex.ac.uk, Office hours: Wed 12-13 in
1 / 1
2 / 1
Lexical analysis Syntax analysis Source program Semantic analysis, e.g. type checking Intermediate code generation Optimisation Code generation Translated program
3 / 1
4 / 1
5 / 1
6 / 1
7 / 1
1 1 1 1 1
8 / 1
9 / 1
10 / 1
11 / 1
12 / 1
NFA, epsilon automaton DFA Table-driven implementation of DFA Regular expressions Lexical specification
Brzozowski derivatives
13 / 1
initial terminal1 terminal2 epsilon epsilon 1
14 / 1
15 / 1
initial terminal1 terminal2 1 1 1 initial epsilon terminal1 terminal2 1 1 1 epsilon
16 / 1
17 / 1
18 / 1
19 / 1
20 / 1
21 / 1
epsilon epsilon epsilon epsilon
22 / 1
epsilon
23 / 1
epsilon epsilon epsilon epsilon 24 / 1
25 / 1
NFA, epsilon automaton DFA Table-driven implementation of DFA Regular expressions Lexical specification
Brzozowski derivatives
26 / 1
27 / 1
28 / 1
29 / 1
e e e 1 1 e e e
30 / 1
1 1 1
31 / 1
32 / 1
33 / 1
NFA, epsilon automaton DFA Table-driven implementation of DFA Regular expressions Lexical specification
Brzozowski derivatives
34 / 1
1 1 1
1
1
35 / 1
1 1 1
1
36 / 1
37 / 1
1 1 1
1
38 / 1
39 / 1
initial
40 / 1
initial
41 / 1
42 / 1
43 / 1
44 / 1
45 / 1
46 / 1
47 / 1
48 / 1