-
Notifications
You must be signed in to change notification settings - Fork 0
/
imp.mli
178 lines (108 loc) · 3.45 KB
/
imp.mli
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
val negb : bool -> bool
val app : 'a1 list -> 'a1 list -> 'a1 list
val add : int -> int -> int
val mul : int -> int -> int
val sub : int -> int -> int
module Nat :
sig
val eqb : int -> int -> bool
val leb : int -> int -> bool
end
type positive =
| XI of positive
| XO of positive
| XH
type n =
| N0
| Npos of positive
module Pos :
sig
val succ : positive -> positive
val add : positive -> positive -> positive
val add_carry : positive -> positive -> positive
val mul : positive -> positive -> positive
val iter_op : ('a1 -> 'a1 -> 'a1) -> positive -> 'a1 -> 'a1
val to_nat : positive -> int
end
module N :
sig
val add : n -> n -> n
val mul : n -> n -> n
val to_nat : n -> int
end
val rev : 'a1 list -> 'a1 list
val map : ('a1 -> 'a2) -> 'a1 list -> 'a2 list
val fold_left : ('a1 -> 'a2 -> 'a1) -> 'a2 list -> 'a1 -> 'a1
val fold_right : ('a2 -> 'a1 -> 'a1) -> 'a1 -> 'a2 list -> 'a1
val forallb : ('a1 -> bool) -> 'a1 list -> bool
val n_of_digits : bool list -> n
val n_of_ascii : char -> n
val nat_of_ascii : char -> int
val string_dec : char list -> char list -> bool
val append : char list -> char list -> char list
val beq_string : char list -> char list -> bool
type 'a total_map = char list -> 'a
val t_empty : 'a1 -> 'a1 total_map
val t_update : 'a1 total_map -> char list -> 'a1 -> char list -> 'a1
type state = int total_map
type aexp =
| ANum of int
| AId of char list
| APlus of aexp * aexp
| AMinus of aexp * aexp
| AMult of aexp * aexp
type bexp =
| BTrue
| BFalse
| BEq of aexp * aexp
| BLe of aexp * aexp
| BNot of bexp
| BAnd of bexp * bexp
val aeval : state -> aexp -> int
val beval : state -> bexp -> bool
type com =
| CSkip
| CAss of char list * aexp
| CSeq of com * com
| CIf of bexp * com * com
| CWhile of bexp * com
val ceval_step : state -> com -> int -> state option
val isWhite : char -> bool
val isLowerAlpha : char -> bool
val isAlpha : char -> bool
val isDigit : char -> bool
type chartype =
| White
| Alpha
| Digit
| Other
val classifyChar : char -> chartype
val list_of_string : char list -> char list
val string_of_list : char list -> char list
type token = char list
val tokenize_helper : chartype -> char list -> char list -> char list list
val tokenize : char list -> char list list
type 'x optionE =
| SomeE of 'x
| NoneE of char list
type 't parser0 = token list -> ('t * token list) optionE
val many_helper :
'a1 parser0 -> 'a1 list -> int -> token list -> ('a1 list * token list)
optionE
val many : 'a1 parser0 -> int -> 'a1 list parser0
val firstExpect : token -> 'a1 parser0 -> 'a1 parser0
val expect : token -> unit parser0
val parseIdentifier : token list -> (char list * token list) optionE
val parseNumber : token list -> (int * token list) optionE
val parsePrimaryExp : int -> token list -> (aexp * token list) optionE
val parseProductExp : int -> token list -> (aexp * token list) optionE
val parseSumExp : int -> token list -> (aexp * token list) optionE
val parseAExp : int -> token list -> (aexp * token list) optionE
val parseAtomicExp : int -> token list -> (bexp * token list) optionE
val parseConjunctionExp : int -> token list -> (bexp * token list) optionE
val parseBExp : int -> token list -> (bexp * token list) optionE
val parseSimpleCommand : int -> token list -> (com * token list) optionE
val parseSequencedCommand : int -> token list -> (com * token list) optionE
val bignumber : int
val parse : char list -> (com * token list) optionE
val empty_state : int total_map