1.2.2 (e. Stages of compilation (lexical analysis, syntax analysis, code generation and optimisation))

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 6:43 PM on 3/14/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

10 Terms

1
New cards

What stages does a compiler go through to convert source code to object code?

Lexical analysis​

Symbol table​

Syntax analysis​

Semantic analysis​

Code generation

2
New cards

What happens during lexical analysis?

- All unnecessary spaces and comments ​are removed​

- Keywords (e.g. print), constants and identifiers are replaced with tokens representing their function in the program

3
New cards

What is a lexer?

builds up a symbol table for every keyword and identifier in a program​

4
New cards

What is the symbol table?

helps to keep track of the run-time memory address for each identifier

5
New cards

What are the token classes?

Identifier​:Any function or variable name​

Keyword​:As If Else EndIf Function EndFunction Return​

Separator​:( ) &​

Operator​:+ - * / % ^ DIV MOD < <= > >=​

Literal​:Hello world​

Number​: -4 0 3.4​

Quote​: " "​

Bool​: True False​

Datatype​: Integer Decimal String Boolean

6
New cards

What is syntax analysis?

The process of splitting the stream of tokens into phrases, parsing them and recording the error if they are invalid

-If the phrase is not valid, an error will be recorded

7
New cards

What is semantic analysis?

Checks if syntactically correct statements are logically correct and can actually work in the program

8
New cards

What is code generation?

- Once the program has been checked, the compiler generates the machine code​

- It may do this in several 'passes' over the code because code optimisation will also take place

9
New cards

What is code optimisation?

Tweaking the code so it will run as efficiently as possible.

This might mean optimising the speed of execution or optimising for using as little memory as possible.

10
New cards

What are disadvantages of code optimisation?

- It will increase compilation time, sometimes quite

considerably

- it may sometimes produce unexpected results.

Explore top flashcards

flashcards
4th Grade Rocks Vocab
20
Updated 200d ago
0.0(0)
flashcards
AP Human Geography Unit 10
31
Updated 1089d ago
0.0(0)
flashcards
Healthful living test Q1
50
Updated 866d ago
0.0(0)
flashcards
Herps crocs&turtles
28
Updated 1109d ago
0.0(0)
flashcards
Purnell Model
21
Updated 1126d ago
0.0(0)
flashcards
Expanded Elements to Know
49
Updated 1258d ago
0.0(0)
flashcards
4th Grade Rocks Vocab
20
Updated 200d ago
0.0(0)
flashcards
AP Human Geography Unit 10
31
Updated 1089d ago
0.0(0)
flashcards
Healthful living test Q1
50
Updated 866d ago
0.0(0)
flashcards
Herps crocs&turtles
28
Updated 1109d ago
0.0(0)
flashcards
Purnell Model
21
Updated 1126d ago
0.0(0)
flashcards
Expanded Elements to Know
49
Updated 1258d ago
0.0(0)