-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.ml
More file actions
76 lines (61 loc) · 1.45 KB
/
program.ml
File metadata and controls
76 lines (61 loc) · 1.45 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
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
type mvars = {
mva_name: string;
mva_type: mtype;
mva_value: mtype_val;
}
type mcmd_val = {
mcm_cmd : string;
mcm_args : string list;
res : int option; (*if res is None, the command has not already been executed*)
print: string option;
print_error: string option;
print_std: string option;
}
type mbase_type =
| MTypeString
| MTypeInt
| MTypeCmd
type mbase_type_val =
| MTypeStringVal of string
| MTypeIntVal of int
| MTypeCmdVal of mcmd_val
type mtype_field = {
mtf_name : string;
mtf_type: mtype;
}
type mtype_field_val = {
mtfv_name : string;
mtfv_type: mtype_val;
}
type mcomposed_type = {
mct_name: string;
mct_type: mtype_field list;
}
type mcomposed_type_val = {
mcv_type: mtype_field_val list;
}
type msimple_type =
| MBase_type of mbase_type
| MList_type of msimple_type
| MSet_type of msimple_type
| MMap_type of mbase_type * msimple_type
type mtype =
| MComposed_type of mcomposed_type
| MBase_type of msimple_type
type mtype_val = {
| MComposed_val of mcomposed_type_val
| MBase_val of mbase_type_val
(** A scope contains types and variables*)
type mscope = {
msc_father = mscope option; (* None when toplevel*)
msc_vars = mvars list;
msc_type = mtype list; (* always MComposed_type except for toplevel*)
}
type mmodule = {
mmo_name = string (*should start with uppercase*)
mmo_scope = mscope (*upper scope*)
}
type mprogram = {
mpr_modules = mmodule list;
mpr_scopes = mscope list;
}