43 lines
954 B
OCaml
43 lines
954 B
OCaml
type atom =
|
|
| AInt of int
|
|
| ABool of bool
|
|
| AString of string
|
|
| AUnit
|
|
| AVar of Ident.t
|
|
|
|
type expr = {
|
|
a : desc;
|
|
aty : Types.t;
|
|
aspan : Location.span;
|
|
}
|
|
|
|
and desc =
|
|
| AAtom of atom
|
|
| ALet of Ident.t * expr * expr
|
|
| ABinop of Syntax.binop * atom * atom
|
|
| AIf of atom * expr * expr
|
|
| ATuple of atom list
|
|
| ARecord of string * (string * atom) list
|
|
| AField of atom * string
|
|
| AApp of Ident.t * atom
|
|
| ALambda of Ident.t * expr
|
|
| AFilter of atom * Ident.t * expr
|
|
| AMap of atom * Ident.t * expr
|
|
| ASum of atom
|
|
| ACount of atom
|
|
|
|
type program = {
|
|
ap_input : Ident.t;
|
|
ap_input_element : Types.t;
|
|
ap_query : Ident.t;
|
|
ap_query_body : expr;
|
|
ap_helpers : (Ident.t * Types.scheme * expr) list;
|
|
}
|
|
|
|
val reset : unit -> unit
|
|
val program : Typed.program -> program
|
|
val to_string : expr -> string
|
|
val atom_to_string : atom -> string
|
|
val program_to_string : program -> string
|
|
val validate : Ident.t list -> expr -> unit
|