aboutsummaryrefslogtreecommitdiff
path: root/rego-proofs/compiler-rewrite/lib/compiler.mli
blob: b7b14dcd0219c8f537e7766025967fa344b59d6e (plain)
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
type environ

type expr = Term of term | Every of string option * string * term * query

and literal =
  | Exists of expr list * with_modifier option
  | Expr of expr * with_modifier option
  | Negate of expr * with_modifier option

and query = literal list

and term =
  | Scalar of scalar
  | Var of string
  | Ref of reference
  | Array of term list
  | Object of (object_key * term) list
  | Set of term list
  | ArrayComprehension of term * query
  | ObjectComprehension of (object_key * term) * query
  | SetComprehension of term * query
  | Call of reference * term list

and scalar = String of string | Number of float | Bool of bool | Null
and reference = ref_target * term list

and ref_target =
  | Var of string
  | Array of term list
  | Object of (object_key * term) list
  | Set of term list
  | ArrayComprehension of term * query
  | ObjectComprehension of (object_key * term) * query
  | SetComprehension of term * query
  | Call of reference * term list

and object_key = Scalar of scalar | Ref of reference | Var of string
and with_modifier = (term * term) list

type assign_operator = Assign | Unify
type rule_head_lhs = reference

type rule_head_rhs =
  | Assignment of assign_operator * term
  | Function of assign_operator * string list * term
  | Set of term

type rule_head = rule_head_lhs * rule_head_rhs

type rule = {
  default : bool;
  head : rule_head;
  body : query;
  otherwise : rule option;
}

type import = { alias : string option; path : reference }
type package = { path : reference; imports : import list; policy : rule list }

val extract_local_variables_wrapper : query -> string list
val parse_tree : Yojson.Basic.t -> package

© 2015 - 2026 Jakob L. Kreuze