1 Introduction

1.1 Classification of Translators

source-------------object
code   -translator   code




source languageobject language



Compiler high low



Decompiler low high



Assembler low machine



Rewriter high high



1.2 History Snapshots





1946Konrad Zuse Plankalkul

published 1972





1949 John Mauchly Short Code
(Brief Code)

relied on manual conversion





1952 Grace Hopper A-0

first compiler (on UNIVAC)





1957 John Backhus et. al. Fortran

first complete compiler (on IBM 704); introduced subroutines, functions, loops





1960 Algol 60

introduced block-structured language, BNF





1960 Cobol

multiple platforms





1964 Ole-Johan Dahl,
Kristan Nygaard
Simula

introduced classes, inheritance and objects





1965 Donald Knuth

attribute grammars, LR parsing





1966 Niklaus Wirth Algol W

introduced records, case, passing parameters by value, precedence of operators.





1968 Algol 68

introduced casting of types.





1972 Dennis Ritchie C

 





1986 Bjarne Stroustrup C++

 





1994 James Gosling et. al. Java

 





[*][*]

1.3 The Making of Compilers

Front End

        --------|         --------|                               -----------|
        |lexical |         |syntax |          ---------|           intermediate|
source--|analyzer-- tokens--|analyzer--abstract--|semantics-- abstract--|  code    --intermediate
 code   (scanner)-         -(parser)|   tree    -analyzer|   tree    -generator---     code

Back End

             ---code--|  optimized    --code---|
intermediate--|optimizer--intermediate--generator --machine
    code     ---------|     code      ---------|   code

1.4 Theoretical Foundations



lexical analyzers

finite state automata and regular grammars



syntax analyzers

pushdown automata and context free grammars



code generation

data structures



optimization

undecidability, NP-hardness, approximation algorithms,…



1.5 Course Conduct

1.6 The Course Project

Given.

Assignments.

  1. MINI-MACHINE simulator
  2. A table driven scanner
  3. A LL parser
  4. A code generator
  5. A LR parser
  6. Scanner and parser generators