aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-04-21 15:01:17 +0200
committerpacien2018-04-21 15:01:17 +0200
commit1b8fa63e3145a3778e065c42e9fc189344985c99 (patch)
tree2066e4cdd0831a1f0180f791446b51cf4b363581
parent012ad2b3c060032108e224c3cdd03bf0aa05c818 (diff)
downloadurm-1b8fa63e3145a3778e065c42e9fc189344985c99.tar.gz
Add EURM interface
-rw-r--r--common.mli27
-rw-r--r--eurml.mli14
2 files changed, 39 insertions, 2 deletions
diff --git a/common.mli b/common.mli
index a62b083..4fa838d 100644
--- a/common.mli
+++ b/common.mli
@@ -4,15 +4,35 @@
4 *) 4 *)
5 5
6type line = int 6type line = int
7type label = string
7type regidx = int 8type regidx = int
8type regval = int 9type regval = int
9type reg = Reg of regidx * regval 10type reg = Reg of regidx * regval
10 11
11type urmcmd = 12type urmcmd =
13 | URMCopy of regidx * regidx
14 | URMJump of regidx * regidx * line
15 | URMSucc of regidx
16 | URMZero of regidx
17
18type eurmcmd =
19 | Add of regidx * regidx
20 | Comment of string
12 | Copy of regidx * regidx 21 | Copy of regidx * regidx
13 | Jump of regidx * regidx * line 22 | Dec of regidx
14 | Succ of regidx 23 | EqPredicate of regidx * regidx * label
24 | GEqPredicate of regidx * regidx * label
25 | GTPredicate of regidx * regidx * label
26 | Goto of label
27 | Inc of regidx
28 | Label of label
29 | LEqPredicate of regidx * regidx * label
30 | LTPredicate of regidx * regidx * label
31 | Mult of regidx * regidx
32 | Quit
33 | Sub of regidx * regidx
15 | Zero of regidx 34 | Zero of regidx
35 | ZeroPredicate of regidx * label
16 36
17type instptr = InstPtr of (line * urmcmd) list * (line * urmcmd) list 37type instptr = InstPtr of (line * urmcmd) list * (line * urmcmd) list
18 38
@@ -21,4 +41,7 @@ type urm = {
21 regs : reg list 41 regs : reg list
22} 42}
23 43
44type state = { todo : int }
45
24exception Syntax_error 46exception Syntax_error
47
diff --git a/eurml.mli b/eurml.mli
new file mode 100644
index 0000000..1b13dca
--- /dev/null
+++ b/eurml.mli
@@ -0,0 +1,14 @@
1(*
2 * UPEM / L3 / Functional programming / Project: URM
3 * Pacien TRAN-GIRARD, Adam NAILI
4 *)
5
6open Common
7
8val compile_preprocess : eurmcmd list -> eurmcmd list
9val compile_stage1 : eurmcmd list -> state -> eurmcmd list * state
10val compile_stage2 : eurmcmd list -> state -> eurmcmd list * state
11val compile_stage3 : eurmcmd list -> state -> eurmcmd list * state
12val compile_stage4 : eurmcmd list -> state -> urmcmd list * state
13val urm_from_eurm : eurmcmd list -> urmcmd list
14