Compiler Front End
Compiler Front End
Compiler Front End
1
Two Pass Compiler
2
Two Pass Compiler
3
Front End
4
Front End
5
Front End
6
Scanner
7
Scanner
• For example,
the input
x = x + y
becomes
<id,x>
<assign,=>
<id,x>
<op,+>
<id,y> 8
Scanner
9
Parser
10
Context Free Grammars
11
Context Free Grammars
13
Context Free Grammar
14
Context Free Grammars
5. term → id expr op y
7. op → - expr - y
6. op → + expr + 2 - y
5. term → id x + 2 - y
16
Front End
17
Parse
18
Parse Tree
19
Parse Tree
20
Abstract Syntax Tree
21
Abstract Syntax Tree
22