Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 35 lines (32 sloc) 2.319 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
program := program statement | statement | empty
statement := { statement } |
                 identifier = numexpression; |
                 identifier[numexpression] = numexpression; |
                 function(expressionlist); |
                 for (identifer = numexpression; numexpression; identifier = numexpression) { statement } |
                 while (numexpression) { statement } |
                 if (numexpresion) { statement } elif |
                 break; |
                 continue;
                 
elif := else statement | empty
function := abs | countbits | exptmod | jacobi | print | isprime | nextprime | issquare | readinteger | exit
expressionlist := expressionlist, expression | expression

// LR(1) !!!?
expression := string | numexpression
numexpression := cmpexpr && cmpexpr | cmpexpr \|\| cmpexpr | cmpexpr
cmpexpr := boolexpr < boolexpr | boolexpr > boolexpr | boolexpr == boolexpr |
                 boolexpr <= boolexpr | boolexpr >= boolexpr | boolexpr
boolexpr := shiftexpr & shiftexpr | shiftexpr ^ shiftexpr | shiftexpr \| shiftexpr | shiftexpr
shiftexpr := addsubexpr << addsubexpr | addsubexpr >> addsubexpr | addsubexpr
addsubexpr := mulexpr + mulexpr | mulexpr - mulexpr | mulexpr
mulexpr := expr * expr | expr / expr | expr % expr | expr
expr := -nexpr | nexpr
nexpr := integer | identifier | ( numexpression ) | identifier[numexpression]

identifier := identifer digits | identifier alpha | alpha
alpha := a ... z | A ... Z
integer := hexnumber | digits
hexnumber := 0xhexdigits
hexdigits := hexdigits hexdigit | hexdigit
hexdigit := 0 ... 9 | a ... f | A ... F
digits := digits digit | digit
digit := 0 ... 9
Something went wrong with that request. Please try again.