Escape newline in strings
[tiger.ml.git] / compiler / src / lib / tiger / tiger_env_value.ml
CommitLineData
c0bdf964
SK
1module List = ListLabels
2
3module Map = Tiger_map
4module Symbol = Tiger_symbol
5module Type = Tiger_env_type
6
7type t =
8 | Var of
9 {ty : Type.t}
10 | Fun of
11 { formals : Type.t list
12 ; result : Type.t
13 }
14
15type env =
16 (Symbol.t, t ) Map.t
17
18let built_in =
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 )
29 ]
30 |> List.map ~f:(fun (name, formals, result) ->
31 let key = Symbol.of_string name in
32 let value = Fun {formals; result} in
33 (key, value)
34 )
35 |> Map.of_list
This page took 0.037601 seconds and 4 git commands to generate.