Overview
Lecture 1
Table of Contents
Overview
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
- Installing VM software
vagrant init ubuntu/hirsute64
vagrant up
- Installing VM software
- git, make, java
- apt install git openjdk-11-jdk-headless build-essential
- openjdk-11-jdk if you want ANTLR GUI
- git and command-line tutorial
- apt install git openjdk-11-jdk-headless build-essential
- 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
- Front-end
- "Middle-end"
- Back-end
- LLVM Compiler Infrastructure
Front-end
- Language-processing
- Remember regexes, grammar from discrete? (If you took it)
- Type checking
- Did I assign an array to a float?
Back-end
- Code generation
- Equivalent machine code for any valid input program
- Optimization
- Choose equivalent machine code that's faster, smaller, etc.
"Middle-end"
- 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?
- Moon vs. finger pointing at the moon
- "The map is not the territory"
- the compiler itself defines meaning
- defines input language in terms of output language
- (why does output language have meaning?)
ASCII vs. machine code
od
gcc -S
- ASCII table
Homework
HW
- Join slack (see webcourses)
- Setup your git repo (see webcourses)
- Setup your environment (vagrant as needed, java, git, etc.)