Show that you can:
The Cambridge syllabus expects you to recognise each stage and its purpose. The diagram below shows a typical pipeline; an interpreter follows the same stages, but the final “Code Generation” stage produces an intermediate form that is executed directly.

| Stage | Purpose | Typical Output |
|---|---|---|
| Lexical analysis (scanner) | Breaks the source program into a sequence of tokens (identifiers, literals, operators, etc.). | Token stream – e.g. int x = 5 ; → [INT, IDENTIFIER, '=', NUMBER, ';'] |
| Syntax analysis (parsing) | Checks that the token sequence follows the grammatical rules of the language. | Parse tree / abstract syntax tree (AST) |
| Semantic analysis | Ensures the program’s meaning is correct – type checking, scope resolution, declaration before use, etc. | Annotated AST (type information, symbol‑table links) |
| Optimisation | Improves the intermediate representation without changing its meaning (e.g., constant folding, dead‑code elimination). | Optimised intermediate code |
| Code generation | Translates the optimised representation into target code – machine code, assembly, or an intermediate form such as Reverse Polish Notation (RPN). | Target program (executable, byte‑code, etc.) |
Pros: fast execution, whole‑program optimisation.
Cons: longer start‑up time, platform‑specific output.
Pros: immediate feedback, platform‑independent.
Cons: slower execution, limited optimisation.

if ( condition ) statement
BNF expresses a grammar as a set of production rules of the form
<non‑terminal> ::= definition
where definition may contain:
"if").<expr>).| – choice (alternatives){ } – repetition (zero or more)[ ] – optional (zero or one)( ) – grouping<expr> ::= <term> { ("+" | "-") <term> }
<term> ::= <factor> { ("*" | "/") <factor> }
<factor> ::= <integer> | "(" <expr> ")"
<integer> ::= <digit> { <digit> }
<digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
Each BNF rule can be turned into a diagram. Below is a textual description of the diagram for <expr>:
<term> → Loop:<term>
<expr> (addition / subtraction loop)
| Aspect | Syntax Diagrams | BNF Notation |
|---|---|---|
| Representation | Visual, flow‑chart style | Textual, rule‑based |
| Readability for beginners | Often clearer because of graphics | Requires familiarity with BNF symbols |
| Machine processing | Needs conversion to a formal grammar before a parser can be generated | Directly usable by parser generators (e.g., yacc, ANTLR) |
| Expressiveness / size | Can become cumbersome for large grammars | Compact even for complex languages |
yacc, bison, ANTLR or Cambridge‑specific JFlex + CUP read the BNF and automatically generate a parser.| Syllabus Unit (AS) | Covered in these notes? | Action Needed |
|---|---|---|
| 1 Information representation | ✗ | Add a concise binary‑systems cheat‑sheet and a short conversion activity. |
| 1.2 Multimedia – graphics & sound | ✗ | Include bitmap/vector examples and a file‑size calculation exercise. |
| 1.3 Compression (lossy vs. lossless, RLE) | ✗ | Provide a mini‑lab compressing a text file with RLE. |
| 2 Communication (LAN/WAN, topologies, IP, DNS, cloud) | ✗ | Insert IPv4/IPv6 notation, subnetting basics, and public‑vs‑private IP notes. |
| 3 Hardware (components, RAM/ROM, embedded, buffers) | ✗ | Add a table contrasting SRAM/DRAM and PROM/EPROM/EEPROM. |
| 3.2 Logic gates & circuits | ✗ | Provide a half‑adder circuit, its Boolean expression, and truth table. |
| 4 Processor fundamentals (Von Neumann, registers, ALU, CU, buses, F‑E cycle, interrupts) | ✗ | Insert a labelled fetch‑execute diagram and an “interrupt scenario” worksheet. |
| 4.2 Assembly language (two‑pass assembler, addressing modes) | ✗ | Include a small load‑add‑store program and ask students to trace each addressing mode. |
| 4.3 Bit manipulation (shifts, masks, test‑set) | ✗ | Provide bit‑mask exercises (e.g., set/clear a flag). |
| 5 System software (OS functions, utilities, libraries) | ✗ | List typical utilities and map them to OS management tasks. |
| 5.2 Language translators (assembler, compiler, interpreter, IDE features) | ✓ | Ensure the comparison table of compile‑time vs. run‑time error detection is present. |
| 6 Security, privacy & data integrity | ✗ | Add a short case‑study of a phishing attack and a data‑validation checklist. |
| 7 Ethics & ownership | ✗ | Insert a debate prompt on open‑source vs. proprietary licences. |
| 8 Databases (relational concepts, ER diagrams, normalisation, DDL/DML) | ✗ | Provide a brief ER‑diagram example and normalisation exercise. |
Key points to remember
<non‑terminal> ::= …. Use |, { }, [ ].After mastering translation software, the Cambridge syllabus continues with:
Understanding how a compiler interacts with the operating system (loading, linking, I/O) will help you see the whole picture.
For students aiming at the A‑Level
struct or class definitions.try‑catch blocks.while loops with the syntax while ( condition ) statement.<assignment> ::= <identifier> "=" <expr> ";"
if‑else statement (see Figure 2), write the equivalent BNF rule.int x = 10 ; is tokenised.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.