• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1program       := program statement | statement | empty
2statement     := { statement }                                                                              |
3                 identifier = numexpression;                                                                |
4                 identifier[numexpression] = numexpression;                                                 |
5                 function(expressionlist);                                                                  |
6                 for (identifer = numexpression; numexpression; identifier = numexpression) { statement }   |
7                 while (numexpression) { statement }                                                        |
8                 if (numexpresion) { statement } elif                                                       |
9                 break;                                                                                     |
10                 continue;
11
12elif          := else statement | empty
13function      := abs | countbits | exptmod | jacobi | print | isprime | nextprime | issquare | readinteger | exit
14expressionlist := expressionlist, expression | expression
15
16// LR(1) !!!?
17expression    := string | numexpression
18numexpression := cmpexpr && cmpexpr | cmpexpr \|\| cmpexpr | cmpexpr
19cmpexpr       := boolexpr  < boolexpr | boolexpr  > boolexpr | boolexpr == boolexpr |
20                 boolexpr <= boolexpr | boolexpr >= boolexpr | boolexpr
21boolexpr      := shiftexpr & shiftexpr | shiftexpr ^ shiftexpr | shiftexpr \| shiftexpr | shiftexpr
22shiftexpr     := addsubexpr << addsubexpr | addsubexpr >> addsubexpr | addsubexpr
23addsubexpr    := mulexpr + mulexpr | mulexpr - mulexpr | mulexpr
24mulexpr       := expr * expr       | expr / expr | expr % expr | expr
25expr          := -nexpr | nexpr
26nexpr         := integer | identifier | ( numexpression ) | identifier[numexpression]
27
28identifier    := identifer digits | identifier alpha | alpha
29alpha         := a ... z | A ... Z
30integer       := hexnumber | digits
31hexnumber     := 0xhexdigits
32hexdigits     := hexdigits hexdigit | hexdigit
33hexdigit      := 0 ... 9 | a ... f | A ... F
34digits        := digits digit | digit
35digit         := 0 ... 9
36