Application generation Flashcards
1
Q
4 stages of compilation
A
1) Lexical analysis
2) Syntax analysis
3) Code generation
4) Code optimisation
2
Q
lexical analysis
A
- comments + whitespace removed
- tokens are created out of lexemes (keywords)
- tokens are assembled into a symbol table
3
Q
token examples
A
- id
- number
4
Q
syntax analysis
A
- An abstract syntax tree is built
- using the symbol table from lexical analysis
- checks for errors and reports them
5
Q
code generation
A
- machine code is created
6
Q
code optimization
A
- removes variables/subroutines that were never called
- used to improve efficiency
- reduces execution time
- makes the program use fewer resources/less memory
7
Q
compilation stage symbol table is created
A
lexical analysis
8
Q
library
A
pre-written, compiled, tested, and checked pieces of code
Written by other authors / already written
Containing useful routines
9
Q
benefits of libraries
A
- Save time…
…because no need to rewrite the code - Use the expertise of others…
- …to complete tasks that require specialist
knowledge - Has already been tested/the programmer doesn’t
have to test it themselves - Making debugging easier/saving time
10
Q
drawback of libraries
A
- Not written by the programmer
…so introduces uncertainty
11
Q
A