Professional Documents
Culture Documents
Source Program
Lexical Analyzer
Token stream
Sample Program Compiled
Tokens are entities defined by the compiler writer
which are of interest. A sequence of characters
with collective meanings are grouped to form a
token.
Examples of Tokens:
Single Character operator: = + - * > <
More than one character operator: ++, --,==,<=
Numeric Constants: 1997 45.89 19.9e+7
Key Words: int, while, for
Identifiers: x, my_name, Your_Name, a
Homework: Identify all token types in C programs.
Example Program Compiled-Continued
What are the tokens in the example?
root_node
stmt1 stmt2
stmt1 stmt2
=
=
a 100 b +
f 3
( a )
Intermediate-Code Generation
is important
Front end & Back end
Front end: is the phases or parts of phases
that depend on the source language.
Back end: is phases or part of phases that
depend on the target machine.