Checkpoint 1 Flashcards
What does the tipc compiler do?
TIP to LLVM
Why study compilers?
- Learn ins and outs of both source and target language
- Appreciate current limits of compilers
- Learn how to help it do its job
- Implement your own DSL
Arrays vs your own pointer math?
Arrays! Compiler is smarter than you
Standard Imperative Language
this is the input language/source language, like C and Java and tipc, defines various computations, states (variables, objects, arrays), and non semantic content
Compiler Output
Machine code that includes load/store instructions, math/logical instructions, branch instructions… also state (registers)
DSL
domain specific language, language that is focussed on specific applications… need to know about compilers b4 building a dsl (HTML, MATLAB, XML)
Source to middle vs middle to end
Analyze at beginning, synthesize at the end
Scanner?
takes source code and creates tokens
Parser?
takes tokens and puts structure to it using a parse tree
Weeding
puts Parse tree into AST
Middle End stages/what happens?
semantic routines!… traverse AST and derive additional meaning from the rules of the grammar
Back End stages?
Code generation, Optimization, Emit Target Code
Compilers exist to…
translate and improve programs
Other parts that work to transform source code to executables….
Preprocessor, Compiler (creates assembly), Assembler(creates .o), Linker
What stage does IR generation occur? How is it created? WHat is IR?
- Semantic Routines.
- IR = simplified form of assembly
- IR is created by doing a post order traversal of the AST