Disambiguate variant label
[tiger.ml.git] / compiler / src / lib / tiger / tiger_symbol.ml
1 module H = MoreLabels.Hashtbl
2
3 type t =
4 { name : string
5 ; symbol : int
6 }
7
8 let nextsym = ref 0
9
10 let symbols = H.create 16
11
12 let of_string name =
13 match H.find_opt symbols name with
14 | Some symbol ->
15 {name; symbol}
16 | None ->
17 incr nextsym;
18 let symbol = !nextsym in
19 H.replace symbols ~key:name ~data:symbol;
20 {name; symbol}
21
22 let to_string {name; _} =
23 name
This page took 0.072093 seconds and 4 git commands to generate.