Documente Academic
Documente Profesional
Documente Cultură
TO
COMPILER
<<professor>>
Programming Machine
Language Compiler
Language
(Source) (Target)
INTERMEDIATE
CODE
LEXICAL GENERATION
ANALYSIS
CODE
OPTIMIZATION
SYNTAX
ANALYSIS
TARGET CODE
GENERATION
SEMANTIC
ANALYSIS
RTL Compiler is a powerful tool for logic synthesis and analysis for digital
designs.
of alphanumerics
Computer Science Department Slide 17 of 41
LEXICAL ANALYZER:
Lexical Analyzer or Linear Analyzer breaks the sentence
into tokens. For Example following assignment
statement :-
position = initial + rate * 60
Would be grouped into the following tokens:
1. The identifier position.
2. The assignment symbol =.
3. The identifier initial.
4. The plus sign.
5. The identifier rate.
6. The multiplication sign.
7. The number 60
Computer Science Department Slide 18 of 41
SYMBOL TABLE:
Input: result = a + b * c / d
• Tokens:
Slide 27 of 41
Input: result = a + b * c / d
Exp ::= Exp ‘+’ Exp
| Exp ‘-’ Exp
| Exp ‘*’ Exp
| Exp ‘/’ Exp
| ID
Assign ::= ID ‘=‘ Exp
Input: result = a + b * c / d
• Tokens:
‘result’, ‘=‘, ‘a’, ‘+’, ‘b’, ‘*’, ‘c’, ‘/’, ‘d’
identifiers
operators