Back to marketplace

13. Program Construction

No description yet. This curated deck is ready for daily study.

Total cards: 12•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (12)

#1
Front (Question)

What are the 4 stages of program construction?

Back (Answer)

• Lexical analysis • Syntax analysis • Semantic analysis • Code generation and optimisation

#2
Front (Question)

What happens during lexical analysis?

Back (Answer)

• comments, unnecessary spaces and line breaks are removed • keywords, constants and identifiers are replaced by tokens (usually hex tokens) • these tokens allocate a machine code value to each identifier to identify them in the computer’s memory

#3
Front (Question)

What is an identifier table?

Back (Answer)

Identifies all of the variables/ constants in the program and their data types

#4
Front (Question)

What is a reserved word table?

Back (Answer)

Identifies all of the words native to the programming language being used e.g. input, output

#5
Front (Question)

What happens during syntax analysis?

Back (Answer)

• tokens are checked to see if they match the spelling and grammar expected by analysing each token to determine whether they are using the correct syntax • if syntax errors are found, error messages are produced

#6
Front (Question)

What happens during semantic analysis?

Back (Answer)

• variables are checked to ensure they have been properly declared and used, and that they are the correct data type • operations are checked to ensure they are legal for the type of variable they are being used on

#7
Front (Question)

What happens during code generation and optimisation?

Back (Answer)

• constructs in high level languages are replaced by machine code • the code is optimised so that it is more efficient

#8
Front (Question)

What are the aims of code optimisation?

Back (Answer)

• achieve the required output of the program • increase the speed of the program • decrease demand on resources • not delay the overall compilation process

#9
Front (Question)

What is a translator?

Back (Answer)

A program that converts source code (high level languages) into machine/object code.

#10
Front (Question)

What is a compiler?

Back (Answer)

• takes the source code and translates it all in one go • once converted it can be run at any time, but the entire source code file has to be successfully compiled first • compilers can also optimise code adv: - programs run quickly as its already been completely translated - supplied as an executable file, therefore source code cannot be easily modified disadv: - code is translated as a whole, so enough memory must be available to store all the code at once - cannot spot errors - must be recompiled every time source code is changed - object code produced is specific to processor’s architecture

#11
Front (Question)

What is an interpreter?

Back (Answer)

• translates source code one instruction at a time • the resulting machine code is executed immediately • this process is called interpretation adv: - instructions are executed as soon as they are translated - requires less memory as instructions do not need to be stored for later use - errors can be spotted quickly disadv: - interpreters run slower - program has to be translated every time it is ran - interpreters do not produce an executable file, so when being distributed the source code must be provided, which could be modified without permission - interpreters do not optimise code

#12
Front (Question)

What is an assembler?

Back (Answer)

A program that converts assembly language into machine code.