diff options
-rw-r--r-- | src/eurm.ml | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/eurm.ml b/src/eurm.ml index 8198a5b..cc81aef 100644 --- a/src/eurm.ml +++ b/src/eurm.ml | |||
@@ -5,6 +5,8 @@ | |||
5 | 5 | ||
6 | open Common | 6 | open Common |
7 | 7 | ||
8 | let end_label = "end" | ||
9 | |||
8 | let compile_preprocess = | 10 | let compile_preprocess = |
9 | let rec label_table = Hashtbl.create 100 | 11 | let rec label_table = Hashtbl.create 100 |
10 | and id_from_name name = match Hashtbl.find_opt label_table name with | 12 | and id_from_name name = match Hashtbl.find_opt label_table name with |
@@ -12,7 +14,7 @@ let compile_preprocess = | |||
12 | | None -> let new_id = string_of_int (Hashtbl.length label_table) | 14 | | None -> let new_id = string_of_int (Hashtbl.length label_table) |
13 | in Hashtbl.add label_table name new_id; new_id | 15 | in Hashtbl.add label_table name new_id; new_id |
14 | and aux = function | 16 | and aux = function |
15 | | [] -> [ Label("end") ] | 17 | | [] -> [ Label(end_label) ] |
16 | | Comment(_) :: tail -> aux tail | 18 | | Comment(_) :: tail -> aux tail |
17 | | Label(name) :: tail -> Label(id_from_name name) :: aux tail | 19 | | 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 | 20 | | EqPredicate(i, j, name) :: tail -> EqPredicate(i, j, id_from_name name) :: aux tail |
@@ -109,7 +111,7 @@ let compile_stage2 eurmcmds state = | |||
109 | Label(error_label); Quit; Label(end_label); Copy(r1, diff_reg) ], | 111 | Label(error_label); Quit; Label(end_label); Copy(r1, diff_reg) ], |
110 | add_reg_label state 3 3 | 112 | add_reg_label state 3 3 |
111 | 113 | ||
112 | | Quit -> [ Goto("end") ], state | 114 | | Quit -> [ Goto(end_label) ], state |
113 | | any -> [ any ], state | 115 | | any -> [ any ], state |
114 | 116 | ||
115 | in apply_transform (transform) state eurmcmds | 117 | in apply_transform (transform) state eurmcmds |