Compiler%20Construction - PowerPoint PPT Presentation

About This Presentation
Title:

Compiler%20Construction

Description:

by Neng-Fa Zhou. Compiler Construction. CIS 707. Prof. Neng-Fa Zhou. zhou_at_sci.brooklyn.cuny.edu ... by Neng-Fa Zhou. Why Do We Learn Compilers? Design and ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 15
Provided by: sciBrook
Category:

less

Transcript and Presenter's Notes

Title: Compiler%20Construction


1
Compiler Construction
  • CIS 707
  • Prof. Neng-Fa Zhou
  • zhou_at_sci.brooklyn.cuny.edu
  • http//www.sci.brooklyn.cuny.edu/zhou/

2
What is a Compiler?
target program
compiler
source program
error messages
  • Gcc gcc S myprog.c
  • Javap javap c MyClass

3
Why Do We Learn Compilers?
The principles and techniques of compiler
writing are so pervasive that the ideas found in
this book will be used many times in the career
of a computer scientist.
  • Design and implement languages
  • Use languages more effectively
  • Many other application areas
  • Data (text, image, audio, video) processing
  • Information retrieval
  • Bio-informatics

4
The Context of a Compiler
analysis
synthesis
5
Analysis of Source Programs
source program
lexical analyzer
tokens
syntax analyzer
parse trees
semantic analyzer
parse trees
6
Lexical Analysis
tokens
7
Syntax Analysis
parse tree
8
Semantic Analysis
type checking type conversion
9
Symbol Table
  • There is a record for each identifier
  • The attributes include name, type, location, etc.

10
Synthesis of Object Code
parse tree symbol table
intermediate code generator
intermediate code
code optimizer
optimized intermediate code
code generator
target program
11
Intermediate Code Generation
12
Code Optimization
13
Code Generation
14
Interpreters and Compilers
  • The boundary between interpreters and compilers
    is becoming vague
  • Interpreters interpret intermediate forms of
    programs
  • Parse trees (Basic, Tcl, and Pearl)
  • Virtual machine code (Java, Lisp, and Prolog)
  • Native code compiler
Write a Comment
User Comments (0)
About PowerShow.com