[InstCombine] Signed saturation tests. NFC
[llvm-complete.git] / examples / OCaml-Kaleidoscope / Chapter7 / ast.ml
blobc699e8074a4ac17fc852391bae2b794ca87424b4
1 (*===----------------------------------------------------------------------===
2 * Abstract Syntax Tree (aka Parse Tree)
3 *===----------------------------------------------------------------------===*)
5 (* expr - Base type for all expression nodes. *)
6 type expr =
7 (* variant for numeric literals like "1.0". *)
8 | Number of float
10 (* variant for referencing a variable, like "a". *)
11 | Variable of string
13 (* variant for a unary operator. *)
14 | Unary of char * expr
16 (* variant for a binary operator. *)
17 | Binary of char * expr * expr
19 (* variant for function calls. *)
20 | Call of string * expr array
22 (* variant for if/then/else. *)
23 | If of expr * expr * expr
25 (* variant for for/in. *)
26 | For of string * expr * expr * expr option * expr
28 (* variant for var/in. *)
29 | Var of (string * expr option) array * expr
31 (* proto - This type represents the "prototype" for a function, which captures
32 * its name, and its argument names (thus implicitly the number of arguments the
33 * function takes). *)
34 type proto =
35 | Prototype of string * string array
36 | BinOpPrototype of string * string array * int
38 (* func - This type represents a function definition itself. *)
39 type func = Function of proto * expr