Please enable JavaScript.
Coggle requires JavaScript to display documents.
Code Compilation - Coggle Diagram
Code Compilation
Lexical Analysis
each element in the code is turned into tokens
e.g. a = 5 would turn into: [Identifier:a] [operator:=] [literal:5]
this is known as a token stream
spaces, comments and indents removed
Optimisation
compiler finds unnecessary code that is repeated and removes it
unreachable code is removed
Syntax Analysis
Checks the code for errors where it breaks the rules of the programming language
finds location of the error and may even suggest a solution
syntax tree is created to check the code
Code generation
Syntax tree is converted to object code
the machine code produced before the linker is run
Linkers
need to link the libraries into the file
static link
grabs the whole library code and puts it into the executable file
occurs during compilation
dynamic link
occurs during program running
only takes the specific function that has been called from the library
Loaders
watch a craig n dave video on this