Computing - Backus-Naur Form
AQA Computer Science 2022
What Backus-Naur Form is
What is Backus-Naur Form?
A formal notation used to describe the syntax rules of a language.
What type of languages can’t be expressed by a regular expression?
Context-free languages.
BNF notation symbols
What do two symbols side by side mean in BNF?
That one symbol must follow the other.
Terminal and non-terminal symbols
What is a non-terminal symbol in BNF?
A symbol that can be further broken down.
Writing production rules
What does it look like to define a “digit” category in BNF?
<digit> ::= 0|1|2|3|4|5|6|7|8|9
How would you define a postcode category as two uppercase letters followed by two digits?
postcode category as two uppercase letters followed by two digits?<postcode> ::= <upper><upper><digit><digit>
Why BNF is used
Why is BNF used for programming languages?
Because the instructions for a computer must not be ambiguous in any way.
How could you write a <number> category that’s made of a <digit>?
<number> category that’s made of a <digit>?<number> ::= <digit>|<digit><number>
What does $1234$ match?