aboutsummaryrefslogtreecommitdiff
path: root/evaluator.mli
blob: b296b903e0e5c0b4cc73e6f34e4528b4919c037c (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
62
63
64
65
66
type t

val eval: (ScTypes.refs -> ScTypes.result option ScTypes.Refs.range) -> ScTypes.expression -> ScTypes.result

val repr: Format.formatter -> t -> unit

val get_catalog: unit -> t

(** Type definitions *)

type 'a typ 
val t_bool: DataType.Bool.t typ
val t_int:  DataType.Num.t  typ
val t_string: UTF8.t typ
val t_list: 'a typ -> 'a list typ

(** Result formats *)

type 'a returnType

(** Numeric (any format) *)
val f_num: DataType.Num.t returnType

(** Date *)
val f_date: DataType.Num.t returnType

(** Number *)
val f_number: DataType.Num.t returnType

(** Boolean result *)
val f_bool: DataType.Bool.t returnType

(** String *)
val f_string: DataType.String.t returnType

(** Catalog *)

val register0: 
  string ->           (* The function name *)
  'a returnType ->        (* The return type *)
  (unit -> 'a)        (* The function to call *)
  -> unit

val register1: 
  string ->           (* The function name *)
  'a typ ->           (* The signature *)
  'b returnType ->        (* The return type *)
  ('a -> 'b)          (* The function to call *)
  -> unit

val register2: 
  string ->           (* The function name *)
  ('a typ * 'b typ) ->(* The signature *)
  'c returnType ->        (* The return type *)
  ( 'a -> 'b -> 'c)   (* The function to call*)
  -> unit

val register3: 
  string ->           (* The function name *)
  ('a typ * 'b typ * 'c typ) ->(* The signature *)
  'd returnType ->           (* The return type *)
  ( 'a -> 'b -> 'c -> 'd)   (* The function to call*)
  -> unit

(** [wrap f] run [f] inside a context where there is no functions *)
val wrap: (unit -> 'a) -> 'a