2017-10-25 13:45:44 +02:00
|
|
|
|
(* a simple program syntax in EBNF − Wikipedia *)
|
|
|
|
|
|
program = 'PROGRAM', white space, identifier, white space,
|
|
|
|
|
|
'BEGIN', white space,
|
|
|
|
|
|
{ assignment, ";", white space },
|
2017-11-02 13:47:19 +01:00
|
|
|
|
'END.', [ white space ];
|
2017-10-25 13:45:44 +02:00
|
|
|
|
identifier = alphabetic character, { alphabetic character | digit } ;
|
|
|
|
|
|
number = [ "-" ], digit, { digit } ;
|
2017-10-28 19:16:00 +02:00
|
|
|
|
string = '"' , { all characters }, '"' ;
|
2017-10-25 13:45:44 +02:00
|
|
|
|
assignment = identifier , ":=" , ( number | identifier | string ) ;
|
|
|
|
|
|
alphabetic character = "A" | "B" | "C" | "D" | "E" | "F" | "G"
|
|
|
|
|
|
| "H" | "I" | "J" | "K" | "L" | "M" | "N"
|
|
|
|
|
|
| "O" | "P" | "Q" | "R" | "S" | "T" | "U"
|
|
|
|
|
|
| "V" | "W" | "X" | "Y" | "Z" ;
|
|
|
|
|
|
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
|
|
|
|
|
|
white space = ? white space characters ? ;
|
|
|
|
|
|
all characters = ? all visible characters ? ;
|