Fixed some bugs.
[llvm/zpu.git] / examples / OCaml-Kaleidoscope / Chapter2 / ast.ml
blob4cc2dea86b78bb3b1898e381933412ae9a7f1387
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 binary operator. *)
14 | Binary of char * expr * expr
16 (* variant for function calls. *)
17 | Call of string * expr array
19 (* proto - This type represents the "prototype" for a function, which captures
20 * its name, and its argument names (thus implicitly the number of arguments the
21 * function takes). *)
22 type proto = Prototype of string * string array
24 (* func - This type represents a function definition itself. *)
25 type func = Function of proto * expr