1 module List = ListLabels
4 module Symbol = Tiger_symbol
5 module Type = Tiger_env_type
11 { formals : Type.t list
19 [ ("print" , [Type.String] , Type.Unit )
20 ; ("flush" , [] , Type.Unit )
21 ; ("getchar" , [] , Type.String )
22 ; ("ord" , [Type.String] , Type.Int )
23 ; ("chr" , [Type.Int] , Type.String )
24 ; ("size" , [Type.String] , Type.Int )
25 ; ("substring" , [Type.String; Type.Int; Type.Int] , Type.String )
26 ; ("concat" , [Type.String; Type.String] , Type.String )
27 ; ("not" , [Type.Int] , Type.Int )
28 ; ("exit" , [Type.Int] , Type.Unit )
30 |> List.map ~f:(fun (name, formals, result) ->
31 let key = Symbol.of_string name in
32 let value = Fun {formals; result} in