Difference between revisions of "BNF - Syntax Diagrams"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "Backus Naur Form is a way of describing the syntax of a value to form a new value. There a For example: <digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 This declares that <d...")
 
Line 1: Line 1:
Backus Naur Form is a way of describing the syntax of a value to form a new value. There a
+
Backus Naur Form is a way of describing the syntax of a value to form a new value. <br />
 
For example:
 
For example:
 
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
 
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

Revision as of 09:10, 16 May 2017

Backus Naur Form is a way of describing the syntax of a value to form a new value.
For example: <digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 This declares that <digit> can only be the numbers 0-9, specifically 0 OR 1 OR 2 OR 3 etc.

This notation can also be recursive: <integer> ::= <digit> | <digit><integer> This states that an integer can be a digit or a digit followed by another integer.