Show understanding of the various stages in the compilation of a program and the key artefacts produced at each stage.
Translation software converts source code written in a high‑level language into a form that a computer can execute. The most common type is a compiler, which performs a series of well‑defined transformations, often preceded by a pre‑processor (e.g. macro expansion in C/C++).
The compilation process is a pipeline. Each stage receives an input, applies a specific transformation, and produces an output that becomes the input for the next stage.
#include), conditional compilation (#ifdef).<expr> ::= <term> { (“+” | “-”) <term> }
float to an int without conversion).t1 = a + bt1 = 3 + 4t1 = 7A symbol table is a data structure maintained by the compiler that records information about each identifier encountered in the source program.
| Identifier | Type | Scope | Memory / Register |
|---|---|---|---|
total | int | global | 0x1004 |
i | int | for‑loop block | R5 |
max | float | function calc | 0x200C |
| Stage | Typical Error Type | Example |
|---|---|---|
| Lexical analysis | Illegal character / malformed token | ‘@’ in an identifier |
| Syntax analysis | Missing semicolon, mismatched parentheses | ‘if (x > 0 { … }’ |
| Semantic analysis | Type mismatch, undeclared variable, scope violation | Assigning float to int without conversion |
| Optimization | Transformation that changes program meaning (rare – indicates a bug in the optimiser) | Removing a side‑effecting statement |
| Linking | Unresolved external reference, duplicate symbol | Calling a function that is not defined in any linked library |
| Stage | Input | Output | Primary Purpose |
|---|---|---|---|
| Pre‑processor (optional) | Raw source code | Modified source code | Macro expansion, file inclusion, conditional compilation |
| Lexical analysis | Source characters | Token stream | Identify lexical units; build symbol table |
| Syntax analysis | Token stream | Parse tree / AST | Check grammatical structure using a BNF/EBNF grammar |
| Semantic analysis | AST | Annotated AST | Enforce language semantics (type, scope, declaration rules) |
| Intermediate code generation | Annotated AST | IR (e.g., three‑address code) | Provide a machine‑independent representation |
| Optimization | IR | Optimised IR | Improve execution time, memory usage, or power consumption |
| Code generation | Optimised IR | Target machine code / assembly | Translate to executable instructions; allocate registers |
| Linking & loading | Object modules | Executable program | Resolve external references (static/dynamic) and place program in memory |
Question: Explain the role of the symbol table during compilation and indicate at which stages it is accessed.
Answer outline:
Use this quick‑audit table to verify that your notes cover every required sub‑topic. Tick the “✔” column as you confirm coverage; if a box is empty, add the suggested material.
| Syllabus Section | Covered? (✔) | Suggested Action if Gap Exists |
|---|---|---|
| 1 Information Representation • Binary, BCD, ASCII/Unicode • Two’s‑/one’s‑complement, overflow |
Add a “Binary arithmetic & overflow” box with a conversion table (binary ↔ decimal ↔ hexadecimal) and a short example of two’s‑complement subtraction. | |
| 1.2 Multimedia • Bitmap vs. vector graphics • Colour depth, resolution |
Insert labelled diagrams of a bitmap image and a vector image; include a quick “size‑estimate” calculation (e.g., 800 × 600 px, 24‑bit colour). | |
| 1.3 Compression • Lossy vs. lossless • Run‑Length Encoding (RLE) |
Provide a one‑page RLE walk‑through (e.g., compressing the string “AAAAABBB”). | |
| 2 Communication • LAN/WAN, client‑server vs. peer‑to‑peer • Topologies, cloud, wired vs. wireless • Ethernet/CSMA‑CD, IP addressing, DNS, URLs |
Create a “Network cheat‑sheet” with topology icons, IPv4/IPv6 format, subnet mask basics and a step‑by‑step DNS lookup illustration. | |
| 3 Hardware • CPU, RAM/ROM, SRAM/DRAM • PROM/EPROM/EEPROM, buffers • Embedded systems, sensors/actuators |
Add a comparison table of RAM types (SRAM vs. DRAM) with typical use‑cases; include a short case‑study of an embedded sensor system (e.g., temperature sensor → microcontroller → actuator). | |
| 4 Processor Fundamentals • Von Neumann model, registers, ALU, CU, buses • Fetch‑Execute cycle, interrupts • Performance factors (clock speed, CPI, parallelism) |
Insert a labelled datapath diagram and a step‑by‑step Fetch‑Execute cycle flowchart; summarise performance factors in a bullet list. | |
| 5 System Software • OS purposes, utility software • Program libraries, language translators, IDE features |
Provide a side‑by‑side comparison of a compiler vs. an interpreter (pros/cons) and list typical IDE features (syntax highlighting, debugger, build tools). | |
| 6 Security & Data Integrity • Security, privacy, integrity • Threats, firewalls, encryption • Validation & verification techniques |
Add a “Threat‑mitigation matrix” (e.g., phishing → strong passwords + anti‑phishing filter) and a brief note on hash functions for data integrity. | |
| 7 Ethics & Ownership • Professional ethics, copyright • Software licences, AI impact |
Insert an “Ethics decision tree” for a scenario such as re‑using open‑source code in a commercial product. | |
| 8 Databases • Limitations of file‑based storage • Relational model, ER diagrams, normalisation • DBMS features, DDL/DML, basic SQL |
Provide a mini‑ER‑diagram exercise (e.g., Students‑Courses relationship) and a 3‑NF normalisation worksheet with a sample table. | |
| 9 Algorithm Design • Abstraction, decomposition • Pseudocode, flowcharts, stepwise refinement • Basic search (linear, binary) and sort (bubble, selection) |
Add a pseudocode template with placeholders for input, processing, and output; include a flowchart for binary search and a table comparing search/sort complexities. | |
| Compilation (covered above) | ✔ | – |
When you have a tick in every “✔” column, your notes are fully aligned with the 2026 Cambridge AS & A‑Level Computer Science syllabus.
Create an account or Login to take a Quiz
Log in to suggest improvements to this note.
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.