Professional Documents
Culture Documents
TEKNIK KOMPILASI
MATERI
TRANSLATOR:
COMPILER & INTERPRETER
COMPILER
LATAR BELAKANG
What Are They and What Kinds of Compilers are Out There?
JIT Compiler
Translates virtual machine code to native code. Operates within a virtual
machine. Example: Sun's HotSpot java machine.
Preprocessor
Translates source code into simpler or slightly lower level source code, for
compilation by another compiler. Examples: cpp, m4.
Pure interpreter
Executes source code on the fly, without generating machine code.
Example: Lisp.
Ernastuti & Sulistyo 23/45
Teknik Kompilasi I
Phases of a Compiler
¾ Lexical Analysis:
Converts a sequence of characters into words, or tokens
¾ Syntax Analysis:
Converts a sequence of tokens into a parse tree
¾ Semantic Analysis:
Manipulates parse tree to verify symbol and type information
¾ Optimization:
Manipulates intermediate code to produce a more efficient program
Blok Diagram
Program
Program Program
Program
Sumber
Sumber Sasaran
Sasaran
ANALISA SINTESA
Penganalisa
Penganalisa Penganalisa Semantik Pembentuk Pengoptimal
Leksikal Sintaks Pembangkit kode kode
(scanner) (parser) Kode antara
TABEL
TABEL
SIMBOL
SIMBOL
Hirarki CHOMSKY
ATURAN PRODUKSI
DIAGRAM STATE
DIAGRAM SYNTAX
DIAGRAM SYNTAX