AQA A-level Computer Science (7517)Specification point 4.4.3.1

AQA 7517 4.4.3.1: Backus-Naur Form (BNF)/syntax diagrams

The free BugBot lessons that teach this point, a robot to try it on, and the past-paper questions that test it.

What it covers

A programming language needs a precise definition of what counts as a valid program, so that every compiler for it agrees. Regular expressions are not enough: they cannot describe brackets nested to any depth, and every real language has those. Backus-Naur Form (BNF) can. It was invented to define the language ALGOL 60 and is still how language syntax is written down. Syntax diagrams show the same rules as pictures.

  • Production rules
  • A robot command language
  • Syntax diagrams
  • Why BNF can do what a regex cannot
  • Checking syntax with recursion
Read the free lesson (25 min)

Or do it in the simulator, with tasks that mark themselves

Lessons that teach it

  1. A6.5 Backus-Naur Form and syntax diagrams Theory of computation
    Production rules, syntax diagrams, a grammar for robot programs, recursive descent, and why BNF can describe what a regex cannot.
  2. A6.10 Project: the mission robot Theory of computation
    Validate a mission with a regular expression, carry it out with a Mealy machine, and report with sets.

Try it on a robot

The task from A6.5 Backus-Naur Form and syntax diagrams, running here. Change the program and press Run.

The specification is AQA's own document; this page says which of our lessons teach point 4.4.3.1 and is not endorsed by the board.