Stages of Compilation (OCR A-Level Computer Science): Flashcards

📚Flashcards
Stages of Compilation
Sign up to keep revising.Create a free account to study more flashcards and track your progress.

Practise the cards

12 cards from this deck

Show

Compilation definition

Converting high-level code to machine code that a processor can execute

Four main stages of compilation

Lexical Analysis, Syntax Analysis, Code Generation, Optimisation

Purpose of lexical analysis

Break code into tokens & remove unnecessary elements

Tokenisation

Dividing code into atomic units like keywords & identifiers

What lexical analysis removes

Whitespace and comments

Symbol table

Stores identifiers (variables, functions) during lexical analysis

Purpose of syntax analysis

Check tokens follow correct language syntax rules

AST (Abstract Syntax Tree)

Tree structure representing hierarchical relationships of code elements

Purpose of code generation

Convert AST into machine code/object code

Purpose of optimisation

Refine object code for execution efficiency & memory use

What optimisation removes

Redundant code, repeated calculations, excess memory access

Impact of comments on compilation

None - removed during lexical analysis

Join 100,000+ A-Level students studying Flashcards with us.

Select your subjects, and get access to A+ resources today.