Application Software
Systems Software
Utilities
Open Source Software
Closed Source Software
Translators
Compiler
Interpreter
Assembler
Stages of Compliation
Lexical Analysis: Whitespace & comments are removed from code
- Remaining code analysed for keywords & names of variables & constants. Replaced w/ tokens & information about the token associated with each keyword/identifier is stored in symbol table
Syntax Analysis: Tokens are analysed against the grammar/rules of language
- Any tokens that break the rules are flagged as syntax errors & added to a list
- E.g undeclared variable, incomplete set of brackets
- Abstract syntax tree is produced, represents source code in the form of a tree. Further detail about identifiers is also added to the symbol table
- Semantic analysis also carried out, where logic mistakes are detected.
- E.g multiple declaration, undeclared identifiers
Code Generation: Abstract syntax tree used to produce machine code
Optimisation: Detect & remove insignificant, redundant parts of the code.
- Replace repeated sections with more efficient code without altering behavior.
- Optimise for runtime performance, even if it increases compilation time.
- Excessive optimization might change program behavior
Linkers
Loaders
Use of Libraries