// BNF grammar for BCPL // Tom Crick (tomcrick@users.sourceforge.net) // http://gccbcpl.sourceforge.net // 2004-07-26 // Identifiers, strings, numbers ::= 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 ::= 0|1|2|3|4|5|6|7 ::= 0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F ::= 0|1|2|3|4|5|6|7|8|9 ::= "<255 or fewer characters>" ::= '' ::= #[] ::= #X[] ::= | | [] ::= [ | | .] // Operators
::= @ | ! ::= * | / | REM ::= + | - ::= = | ¬= | <= | >= | < | > ::= << | >> ::= & ::= | ::= EQV | NEQV ::= ¬ // Expressions ::= | | | | TRUE | FALSE ::= () | ( ) | () | ::= ! |
::=
| ::=
|
::= | | ::= [] ::= | ::= | ::= [] ::= [] ::= [] ::= -> , | ::= | TABLE[,] | VALOF // Constant-expressions ::= | | | TRUE | FALSE | () ::= | ::= | | ::= | ::= | ::= | // Lists of expressions and identifiers ::= [,] ::= [,] // Declarations ::= = ::= [;] ::= MANIFEST$($) ::= STATIC$($) ::= : ::= [;] ::= GLOBAL$($) ::= = ::= =VEC ::= ()= | ( )= ::= () BE | ( ) BE ::= | | | ::= LET [ AND ] ::= | | | // LHS expressions ::= | ! | ! ::= [,] // Unlabelled commands ::= := ::= BREAK | LOOP | ENDCASE | RETURN | FINISH ::= GOTO ::= () | ( ) ::= RESULTIS ::= SWITCHON INTO ::= REPEAT | REPEATUNTIL | REPEATWHILE ::= UNTIL DO ::= WHILE DO ::= FOR = TO BY DO | FOR = TO DO ::= | | | ::= TEST THEN ELSE ::= IF THEN ::= UNLESS THEN ::= | | | // Labelled commands