-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathast.ml
50 lines (44 loc) · 1.14 KB
/
ast.ml
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
open Common
(** Terms *)
type term =
| TNumber of int
| TString of string
| TAtom of name
| TVariable of name
| TBinOp of string * term * term
| TStructure of name * term list
(** Derived ctors for terms *)
let nil = TAtom "nil"
let list first rest = TStructure ("cons", [first; rest])
(** Plans *)
type clause =
{ triggering_event: triggering_event;
annotations: formula list;
context: term;
body: plan_stmt }
and triggering_event =
{ event_type: event_type;
goal_type: goal_type;
formula: formula }
and event_type = Add | Del
and goal_type = Achievement | Test
and plan_stmt =
| ActionNop
| Action of plan_action
| ActionSeq of plan_action * plan_stmt
| ActionDo of plan_action * plan_stmt
and plan_action = action_op * formula
and action_op =
| Call
| AsyncCall
| ActionCall
| MVarTake
| MVarRead
| MVarPut
and formula = name * term list
type toplevel_entry =
| Belief of formula * formula list
| Clause of clause
let clause_name { triggering_event } = fst triggering_event.formula
let clause_args { triggering_event } = snd triggering_event.formula
let clause_annotations { annotations } = annotations