aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpacien2018-04-29 23:48:06 +0200
committerpacien2018-04-29 23:48:06 +0200
commit281aca58971995261e713db03a39676639d700cd (patch)
tree04b244f680a0cab058df235f9aff19f95a78c1fb /src
parent97a5d3600a06e2edbd6bb6faa6fa0728add0d5d3 (diff)
downloadurm-281aca58971995261e713db03a39676639d700cd.tar.gz
Implement compile_preprocess
Diffstat (limited to 'src')
-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