Introduction to compilers
What is a compiler
Translate program from source language to target language Preserve semantics
Purpose of Parsing
Analyze the phrase structure of the program
Purpose of Lexing
Break the source file into individual words (aka tokens)
Purpose of IR represenation
Bring source and target language closer. The notation of IR is not tied to the source language or target-machine architecture.
Purpose of Semantic Analysis
Determine the meaning of each phrase. Relate use of varaibles to their definitions. Check types. Request translation of each phrase.
Why make/use compilers
Economy (micro-level decisions already handled) Performance Safety & Securit
Fundamentals of compilers
Preserve semantics Some discernible utility → #useful
Purpose of Hoisting phase
???
Properties of a good compiler
Generates correct and fast code Conforms to the language specifications Supports arbitrary size inputs Good compilation speed