Commit | Line | Data |
---|---|---|
a131e30c SK |
1 | module Sym = Tiger_symbol |
2 | ||
c0bdf964 SK |
3 | type unique |
4 | ||
5 | type t = | |
6 | | Unit | |
7 | | Nil | |
8 | | Int | |
9 | | String | |
10 | | Record of | |
11 | { unique : unique | |
523e2b06 | 12 | ; fields : record_fields |
c0bdf964 SK |
13 | } |
14 | | Array of | |
15 | { unique : unique | |
16 | ; ty : t | |
17 | } | |
a131e30c | 18 | | Name of Sym.t * t option ref |
523e2b06 | 19 | and record_fields = |
a131e30c | 20 | (Sym.t * t) list |
c0bdf964 SK |
21 | |
22 | type env = | |
a131e30c | 23 | (Sym.t, t ) Tiger_map.t |
c0bdf964 SK |
24 | |
25 | val built_in : env | |
26 | ||
27 | val is_equal : t -> t -> bool | |
523e2b06 | 28 | |
c0bdf964 | 29 | val is_int : t -> bool |
523e2b06 SK |
30 | val is_string : t -> bool |
31 | val is_array : t -> bool | |
32 | val is_record : t -> bool | |
c0bdf964 SK |
33 | val is_name : t -> bool |
34 | ||
523e2b06 | 35 | val if_record : t -> f:(record_fields -> 'a) -> otherwise:(unit -> 'a) -> 'a |
161a300d | 36 | val if_array : t -> f:(t -> 'a) -> otherwise:(unit -> 'a) -> 'a |
523e2b06 | 37 | |
a131e30c SK |
38 | val new_record : name:Sym.t -> fields:record_fields -> t |
39 | val new_array : name:Sym.t -> ty:t -> t | |
c0bdf964 SK |
40 | |
41 | val to_string : t -> string |