aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-04-30 22:30:49 +0200
committerpacien2018-04-30 22:30:49 +0200
commit9f873522a083306ad3abd679dbc36c0f519ddfd3 (patch)
treece54a0735d5d4b59256d793426e99a49d53e3fb8
parent50d9fa50080ebb2ca0e38664f158694cc73c8398 (diff)
downloadurm-9f873522a083306ad3abd679dbc36c0f519ddfd3.tar.gz
Use const for end label
-rw-r--r--src/eurm.ml6
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
6open Common 6open Common
7 7
8let end_label = "end"
9
8let compile_preprocess = 10let 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