1.2 Compilers Flashcards
1
Q
What is Lexical ?
A
Relating to words or the vocabulary of
a language.
2
Q
What is Syntax ?
A
The structure of words in a language.
3
Q
What is Lexical analysis ?
A
- Comments and white space removed.
- Variables added to symbol table.
- Reserved words tokenised (e.g.while)
4
Q
What is the Symbol Table ?
A
Each item in the code is given a number (token)…
that the compiler uses instead of the item’s name.
5
Q
What are the steps of running code ?
A
Lexical analysis
|
Syntax analysis
|
Code generation
|
Optimisation
6
Q
What is Syntax Analysis ?
A
- Code (now tokenised) is checked against the rules of the language.
- Errors reported as a list.
- Detail of data types added to symbol
table.
7
Q
What is Code generation ?
A
The program is converted to machine
code.
8
Q
What is optimisation ?
A
The compiler looks for ways to reduce
the number of instructions.
9
Q
Why is it good to optimise ?
A
- Code may be able to use fewer instructions.
- Some code may be included but never run.
- Faster methods available.