-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathast.ml
31 lines (29 loc) · 832 Bytes
/
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
type var = string
type constructor = string
type operator =
| Plus | Minus | Times (** +, -, * *)
| Gt | Lt | Eq | GtEq | LtEq | NotEq (** >, <, =, >=, <=, <> *)
| Concat (** ^ *)
type expr =
| Unit
| Int of int
| Bool of bool
| String of string
| BinOp of operator * expr * expr
| If of expr * expr * expr
| Var of var
| Let of var * expr * expr
| LetRec of var * expr * expr
| App of expr * expr
| Fun of var * expr
| Pair of expr * expr
| Variant of constructor * expr
| Match of expr * (pattern * expr) list
and pattern =
| PUnit
| PInt of int
| PBool of bool
| PString of string
| PVar of var
| PVariant of constructor * pattern
| PPair of pattern * pattern