annotate tombc/grammar.txt @ 190:d8254fc979e9 libtommath-orig LTM_0.35

Initial import of libtommath 0.35
author Matt Johnston <matt@ucc.asn.au>
date Fri, 06 May 2005 08:59:30 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
190
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 program := program statement | statement | empty
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 statement := { statement } |
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3 identifier = numexpression; |
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4 identifier[numexpression] = numexpression; |
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5 function(expressionlist); |
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 for (identifer = numexpression; numexpression; identifier = numexpression) { statement } |
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7 while (numexpression) { statement } |
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 if (numexpresion) { statement } elif |
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 break; |
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 continue;
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12 elif := else statement | empty
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 function := abs | countbits | exptmod | jacobi | print | isprime | nextprime | issquare | readinteger | exit
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 expressionlist := expressionlist, expression | expression
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 // LR(1) !!!?
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17 expression := string | numexpression
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 numexpression := cmpexpr && cmpexpr | cmpexpr \|\| cmpexpr | cmpexpr
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19 cmpexpr := boolexpr < boolexpr | boolexpr > boolexpr | boolexpr == boolexpr |
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20 boolexpr <= boolexpr | boolexpr >= boolexpr | boolexpr
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 boolexpr := shiftexpr & shiftexpr | shiftexpr ^ shiftexpr | shiftexpr \| shiftexpr | shiftexpr
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 shiftexpr := addsubexpr << addsubexpr | addsubexpr >> addsubexpr | addsubexpr
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 addsubexpr := mulexpr + mulexpr | mulexpr - mulexpr | mulexpr
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24 mulexpr := expr * expr | expr / expr | expr % expr | expr
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
25 expr := -nexpr | nexpr
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
26 nexpr := integer | identifier | ( numexpression ) | identifier[numexpression]
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28 identifier := identifer digits | identifier alpha | alpha
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 alpha := a ... z | A ... Z
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30 integer := hexnumber | digits
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31 hexnumber := 0xhexdigits
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32 hexdigits := hexdigits hexdigit | hexdigit
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33 hexdigit := 0 ... 9 | a ... f | A ... F
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
34 digits := digits digit | digit
d8254fc979e9 Initial import of libtommath 0.35
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35 digit := 0 ... 9