forked from np/hasquail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quail.cf
96 lines (77 loc) · 2.26 KB
/
quail.cf
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
comment "#" ;
comment "//" ;
comment "/*" "*/" ;
Program. Progr ::= [Dec] ;
[]. [Dec] ::= ;
(:). [Dec] ::= Dec [Dec] ;
[]. [Stm] ::= ;
(:). [Stm] ::= Stm [Stm] ;
Decl. Dec ::= Mode Typ Ident Initializer ";" ;
Cnst. Dec ::= "const" Ident ":=" Integer ";" ;
Code. Dec ::= Stm ;
NoInit. Initializer ::= ;
ExpInit. Initializer ::= ":=" Exp ;
IntervalInit. Initializer ::= ":=" [Range] ;
[]. [Range] ::= ;
(:). [Range] ::= Range [Range] ;
Rng. Range ::= "[" Exp "," Exp "]" ;
-- Const. Mode ::= "const" ;
Observable. Mode ::= "observable" ;
Public. Mode ::= "public" ;
Secret. Mode ::= "secret" ;
Private. Mode ::= "private" ;
-- (:[]). [Ident] ::= Ident ;
-- (:). [Ident] ::= Ident "," [Ident] ;
[]. [Index] ::= ;
(:). [Index] ::= Index [Index] ;
Idx. Index ::= "[" Exp "]" ;
SAssign. Stm ::= "assign" Ident [Index] ":=" Exp ";";
SRandom. Stm ::= "random" Ident [Index] ":=" RandExp ";";
SIf. Stm ::= "if" Exp "then" [Stm] ElIfs "fi";
SWhile. Stm ::= "while" Exp "do" [Stm] "od";
SFor. Stm ::= "for" "(" Ident "in" Ident ")" "do" [Stm] "od";
SReturn. Stm ::= "return" ";";
-- _. Stm ::= Stm ";" ;
RandomBit. RandExp ::= "randombit" "(" Double ")";
RandomInt. RandExp ::= "random" "(" Exp "," Exp ")";
NoElse. ElIfs ::= ;
Else. ElIfs ::= "else" [Stm] ;
ElIf. ElIfs ::= "elif" Exp "then" [Stm] ElIfs ;
EOpA. Exp ::= Exp0 Op Exp0 ;
EOpB. Exp0 ::= Exp1 Op0 Exp1 ;
EOpC. Exp1 ::= Exp1 Op1 Exp2 ;
EOpD. Exp2 ::= Exp2 Op2 Exp3 ;
EOpE. Exp ::= Exp1 Op Exp1 ;
EVar. Exp3 ::= Ident [Index] ;
EOp. Exp3 ::= UnOp Exp3 ;
EFac. Exp3 ::= "fac" "(" Exp3 ")";
EInteger. Exp3 ::= Integer ;
_. Exp ::= Exp0 ;
_. Exp0 ::= Exp1 ;
_. Exp1 ::= Exp2 ;
_. Exp2 ::= Exp3 ;
_. Exp3 ::= "(" Exp ")" ;
OPlus. Op1 ::= "+" ;
OTimes. Op2 ::= "*" ;
ODiv. Op2 ::= "/" ;
OXor. Op2 ::= "^" ;
OMod. Op2 ::= "%" ;
OMinus. Op1 ::= "-" ;
OLt. Op0 ::= "<" ;
OLe. Op0 ::= "<=" ;
OGt. Op0 ::= ">" ;
OGe. Op0 ::= ">=" ;
OEq. Op0 ::= "==" ;
ONe. Op0 ::= "!=" ;
OAnd. Op ::= "&&" ;
OOr. Op ::= "||" ;
ONot. UnOp ::= "!" ;
TInt1. Typ ::= "int1" ;
TInt2. Typ ::= "int2" ;
TInt4. Typ ::= "int4" ;
TInt8. Typ ::= "int8" ;
TInt16. Typ ::= "int16" ;
TInt32. Typ ::= "int32" ;
TInt64. Typ ::= "int64" ;
TInt. Typ ::= "int" Integer ;
TArray. Typ ::= "array" "[" Exp "]" "of" Typ ;