Compiler Construction

Topics: Programming language, Parsing, Context-free grammar Pages: 2 (376 words) Published: April 24, 2015
Compiler-a program that translates an executable program in one language into an executable program in another language

Interpreter-a program that reads an executable program and produces the results of running that program

Why do we care to study compiler construction
Compiler construction is a microcosm of computer science
artificial intelligence
greedy algorithms learning algorithms
Algorithms
graph algorithms union-find dynamic programming
Theory
DFAs for scanning parser generators lattice theory for analysis Systems
allocation and naming locality synchronization
Architecture
pipeline management hierarchy management instruction set use

Is Compiler construction not a solved problem?
Machines are constantly changing
Changes in architecture  changes in compilers
new features pose new problems
changing costs lead to different concerns
old solutions need re-engineering
Innovations in compilers should prompt changes in architecture New languages and features

What qualities are important in a good compiler?
1. Correct code
2. Output runs fast
3. Compiler runs fast
4. Compile time proportional to program size
5. Support for separate compilation
6. Good diagnostics for syntax errors
7. Works well with the debugger
8. Good diagnostics for flow anomalies
9. Cross language calls
10. Consistent, predictable optimization

What role does a Scanner plays in a compiler?
map characters to tokens
character string value for a token is a lexeme
eliminate white space
character string value for a token is a lexeme, Typical tokens: id, number, do, end …, Key issue is speed

Why the need for Parser?
recognize context-free syntax
guide context-sensitive analysis
construct IR(s)
produce meaningful error messages
attempt error correction

Define a Context-free grammar-
Context-free syntax is specified with a grammar, usually in Backus-Naur form (BNF)

How are context-free grammars specified?

A...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • COMPILER CONSTRUCTION TOOLS Essay
  • Compiler Essay
  • Manual on Compiler | Saint Paul University Essay
  • Basic Compiler Design Essay
  • Compiler Design Essay
  • Essay on Structure of Compiler
  • Compiler Essay
  • An Overview of a Compiler Essay

Become a StudyMode Member

Sign Up - It's Free