Debian Codegraph @

ipl/packs/euler/euler.grm

raw
1 start : program .
2 program = block ENDPROG!.
3 vardecl = new id NEWDECL! .
4 fordecl = formal id FORMALDECL! .
5 labdecl = label id LABELDECL! .
6 var = id VARID! { "[" expr "]" SUBSCR! | "." DOT! } .
7 logval = true LOGVALTRUE! .
8 logval = false LOGVALFALSE! .
9 number = realN | integerN.
10 reference = "@" var REFERENCE! .
11 # listhead -> "(" LISTHD1!
12 # listhead -> listhead expr "," LISTHD2!
13 # listN -> listhead ")" LISTN1!
14 # listN -> listhead expr ")" LISTN2!
15 listN = "(" LISTHD1! ( ")" LISTN1! | expr listTl ) .
16 listTl = ")" LISTN2! | "," LISTHD2! ( expr listTl | ")" LISTN1! ) .
17 prochead = "'" PROCHD! { fordecl ";" PROCFORDECL! } .
18 procdef = prochead expr "'" PROCDEF! .
19 primary = var ( listN CALL! | VALUE!) | primary1 .
20 primary1 = logval LOADLOGVAL! | number LOADNUM! |
21 symbol LOADSYMB!| reference |
22 listN | tail primary UOP! | procdef |
23 undef LOADUNDEF! | "[" expr "]" PARENS! | in INPUT! |
24 isb var UOP! | isn var UOP! | isr var UOP! |
25 isl var UOP! | isli var UOP! | isy var UOP! |
26 isp var UOP! | isu var UOP! | abs primary UOP! |
27 length var UOP! | integer primary UOP! |
28 real primary UOP! | logical primary UOP! | list primary UOP! .
29 factor = primary factortail.
30 factortail = { "**" primary BOP! } .
31 term = factor termtail.
32 termtail = { "*" factor BOP! | "/" factor BOP! |
33 div factor BOP! | mod factor BOP! } .
34 sum = ("+" term UPLUS! | "-" term NEG! | term) sumtail.
35 sumtail = { "+" term BOP! | "-" term BOP! } .
36 choice = sum choicetail.
37 choicetail = { min sum BOP! | max sum BOP! } .
38
39 relation = choice relationtail.
40 relationtail = [ "=" choice BOP! | "~=" choice BOP!
41 | "<" choice BOP! | "<=" choice BOP!
42 | ">" choice BOP! | ">=" choice BOP! ] .
43
44 negation = "~" relation UOP! | relation .
45 conj = negation conjtail.
46 conjtail = [ and CONJHD! conj CONJ! ].
47 disj = conj disjtail.
48 disjtail = [ or DISJHD! disj DISJ! ] .
49 catenatail = { "&" primary BOP! }.
50
51 truepart = expr else TRUEPT! .
52 ifclause = if expr then IFCLSE! .
53
54 expr = var exprtail | expr1.
55 exprtail = "<-" expr BOP! |
56 ( listN CALL! | VALUE!)
57 factortail
58 termtail
59 sumtail
60 choicetail
61 relationtail
62 conjtail
63 disjtail
64 catenatail .
65
66 expr1 = block .
67 expr1 = ifclause truepart expr IFEXPR! .
68 expr1 = goto primary UOP! .
69 expr1 = out expr UOP! .
70 expr1 = primary1
71 factortail
72 termtail
73 sumtail
74 choicetail
75 relationtail
76 conjtail
77 disjtail
78 catenatail .
79
80 expr1 = ( "+" term UPLUS! | "-" term NEG! )
81 sumtail
82 choicetail
83 relationtail
84 conjtail
85 disjtail
86 catenatail .
87
88 expr1 = "~" relation UOP! conjtail disjtail catenatail .
89
90
91 stat = expr1
92 | id ( ":" LABDEF! stat LABSTMT!
93 | VARID! { "[" expr "]" SUBSCR! | "." DOT! }
94 exprtail ) .
95
96 block = begin BEGIN!
97 { vardecl ";" BLKHD! | labdecl ";" BLKHD!}
98 stat { ";" BLKBODY! stat } end BLK! .
99