Compilers Flashcards
What do compilers do?
They compile one programming language into another; higher to lower level programming language
How does CLANG compiler work?
- Preprocessing (Preprocessor)
- Compilation (Compiler)
- Assembling (Assembler)
- Linking (Linker)
What does the assembler do?
Transforms assembly into machine code
What does linking do?
Links together a bunch of object files into 1 big file you can execute
Explain briefly how a compiler works:
converts from language to another; from high to low
What are the part of the compiler?
Lexer - splits code into tokens
Parser - recognizes patterns of language you wrote the code in - converts to AST (abstract syntax tree)
Generator - converts AST of target language - i.e. Assembly code
Example of Koona
A simple compiler in Ruby:
converts Koona grammer into C