1.2 Compilers Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is Lexical ?

A

Relating to words or the vocabulary of
a language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Syntax ?

A

The structure of words in a language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Lexical analysis ?

A
  • Comments and white space removed.
  • Variables added to symbol table.
  • Reserved words tokenised (e.g.while)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the steps of running code ?

A

Lexical analysis
|
Syntax analysis
|
Code generation
|
Optimisation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Code generation ?

A

The program is converted to machine
code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is optimisation ?

A

The compiler looks for ways to reduce
the number of instructions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly