CS416 Compiler Design
CS416 Compiler Design
CS416 Compiler Design
PRELIMINARIES REQUIRED
3
WHAT IS A TRANSLATOR?
4
TYPE OF TRANSLATORS
6
COMPILERS
Error messages
7
MAJOR PARTS OF COMPILERS
oldval 12
11
SYNTAX ANALYZER (CFG)
Ex:
MULT id2,id3,temp1
ADD temp1,#1,id1
17
CODE GENERATOR
Ex:
( assume that we have an architecture with instructions whose at least one of
its operands is
a machine register)
MOVE id2,R1
MULT id3,R1
ADD #1,R1
18
MOVE R1,id1
OTHER APPLICATIONS
Introduction to Compiling
Lexical Analysis
Syntax Analysis
Context Free Grammars
Top-Down Parsing, LL Parsing
Bottom-Up Parsing, LR Parsing
Syntax-Directed Translation
Attribute Definitions
Evaluation of Attribute Definitions
Semantic Analysis, Type Checking
Run-Time Organization
Intermediate Code Generation 20