aboutsummaryrefslogtreecommitdiff
path: root/src/eurm.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/eurm.ml')
-rw-r--r--src/eurm.ml21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/eurm.ml b/src/eurm.ml
index 7d6c2c6..6985f06 100644
--- a/src/eurm.ml
+++ b/src/eurm.ml
@@ -5,7 +5,26 @@
5 5
6open Common 6open Common
7 7
8let compile_preprocess eurmcmds = eurmcmds 8let compile_preprocess =
9 let rec label_table = Hashtbl.create 100
10 and id_from_name name = match Hashtbl.find_opt label_table name with
11 | Some(id) -> id
12 | None -> let new_id = string_of_int (Hashtbl.length label_table)
13 in Hashtbl.add label_table name new_id; new_id
14 and aux = function
15 | [] -> []
16 | Comment(_) :: tail -> aux tail
17 | Label(name) :: tail -> Label(id_from_name name) :: aux tail
18 | EqPredicate(i, j, name) :: tail -> EqPredicate(i, j, id_from_name name) :: aux tail
19 | GEqPredicate(i, j, name) :: tail -> GEqPredicate(i, j, id_from_name name) :: aux tail
20 | GTPredicate(i, j, name) :: tail -> GTPredicate(i, j, id_from_name name) :: aux tail
21 | LEqPredicate(i, j, name) :: tail -> LEqPredicate(i, j, id_from_name name) :: aux tail
22 | LTPredicate(i, j, name) :: tail -> LTPredicate(i, j, id_from_name name) :: aux tail
23 | ZeroPredicate(i, name) :: tail -> ZeroPredicate(i, id_from_name name) :: aux tail
24 | Goto(name) :: tail -> Goto(id_from_name name) :: aux tail
25 | any :: tail -> any :: aux tail
26 in aux
27
9let compile_stage1 eurmcmds state = eurmcmds, state 28let compile_stage1 eurmcmds state = eurmcmds, state
10let compile_stage2 eurmcmds state = eurmcmds, state 29let compile_stage2 eurmcmds state = eurmcmds, state
11let compile_stage3 eurmcmds state = eurmcmds, state 30let compile_stage3 eurmcmds state = eurmcmds, state