Lesson Plan

Lesson Plan
Grade: Date: 17/01/2026
Subject: Computer Science
Lesson Topic: Show understanding of the need for: a compiler for the translation of a high-level language program
Learning Objective/s:
  • Describe why high‑level programs must be translated before execution.
  • Compare compilation and interpretation in terms of speed, error detection, and portability.
  • Identify and explain the main phases of a compiler pipeline.
  • Evaluate the benefits of using a compiler for performance‑critical and resource‑constrained applications.
Materials Needed:
  • Projector or interactive whiteboard
  • Slides summarising compiler phases
  • Sample high‑level source code (e.g., simple Java program)
  • Compiler demo software (e.g., javac or gcc) on lab computers
  • Worksheet with comparison table and short questions
  • Whiteboard markers
Introduction:
Begin with a quick demonstration: run a short Java program directly in an IDE and then run the compiled .class file, highlighting the speed difference. Ask students what obstacles prevent a computer from executing the high‑level code directly, linking to prior knowledge of machine code. Explain that today’s lesson will uncover why a compiler is essential and how its stages bridge that gap. Success will be measured by students correctly mapping each compiler phase to its purpose.
Lesson Structure:
  1. Do‑Now (5’) – Students answer a short prompt on why computers need machine code, recorded on sticky notes.
  2. Mini‑lecture (10’) – Present the need for translation, portability, optimisation, safety using slides.
  3. Comparison activity (8’) – In pairs, fill a table contrasting compilation vs interpretation; teacher checks understanding.
  4. Compiler pipeline demo (12’) – Walk through each phase using a simple Java program; show token list, parse tree, intermediate code, optimisation, and final executable.
  5. Guided practice (10’) – Students label a flowchart of compiler phases on a worksheet and write one sentence describing each phase.
  6. Quick check (5’) – Exit quiz on Kahoot/Google Form covering key benefits of compilers.
Conclusion:
Summarise that compilers translate high‑level code into efficient machine code, providing speed, safety, and portability. Reinforce the six compiler phases by revisiting the flowchart. For exit, students write one real‑world scenario where a compiler is indispensable. Homework: research a modern compiler optimisation technique and prepare a 2‑minute explanation.