Lecture 1

Table of Contents


Welcome to Compiler Construction!

  • go over syllabus
    • topics, course structure
    • class structure
    • attendance, quizzes (one question, we go over same day)
    • homeworks (short, not graded strictly, just to keep up with course)
    • compilers project, design together in class, implement on your own
    • personal project, pick own project, implementation and present on your own
    • readings, summaries for homework
      • tentative list of papers
      • if you have topics of interest now or during semester let me know
  • about me, research, positions
    • favorite course
    • program analysis and transformation, tool engineers
    • use course project to gauge interest

What do you want to get out of this course?

  • Intros
  • Why are you taking this course?
  • What do you hope to learn?

Expected background

  • Some discrete math background
  • Strong programming
  • Command-line fluency
  • Can install software on your own
  • discrete is even a prerequisite

Course software

  • Linux OS
  • git, make, java
  • ANTLR parser framework
    • apt install antlr4

Compiler Intro

What is a compiler?

What makes compiler-writing hard?

  • Three different programs
    • Input program
    • Ouput program
    • The compiler itself
  • (Diagram)

Compiler phases


  • Language-processing
    • Remember regexes, grammar from discrete? (If you took it)
  • Type checking
    • Did I assign an array to a float?


  • Code generation
    • Equivalent machine code for any valid input program
  • Optimization
    • Choose equivalent machine code that's faster, smaller, etc.


  • Intermediate code
    • Like machine code
    • Without machine specifics
    • Lots of different designs

Symbols vs. meaning

1 + 2 * 3

6 / 2(1 + 2)


What gives symbols meaning?

  • the compiler itself defines meaning
  • defines input language in terms of output language
  • (why does output language have meaning?)

ASCII vs. machine code



  • Join slack (see webcourses)
  • Setup your git repo (see webcourses)
  • Setup your environment (vagrant as needed, java, git, etc.)

Author: Paul Gazzillo

Created: 2022-02-14 Mon 11:49