diff options
author | pacien | 2018-04-21 15:01:17 +0200 |
---|---|---|
committer | pacien | 2018-04-21 15:01:17 +0200 |
commit | 1b8fa63e3145a3778e065c42e9fc189344985c99 (patch) | |
tree | 2066e4cdd0831a1f0180f791446b51cf4b363581 | |
parent | 012ad2b3c060032108e224c3cdd03bf0aa05c818 (diff) | |
download | urm-1b8fa63e3145a3778e065c42e9fc189344985c99.tar.gz |
Add EURM interface
-rw-r--r-- | common.mli | 27 | ||||
-rw-r--r-- | eurml.mli | 14 |
2 files changed, 39 insertions, 2 deletions
@@ -4,15 +4,35 @@ | |||
4 | *) | 4 | *) |
5 | 5 | ||
6 | type line = int | 6 | type line = int |
7 | type label = string | ||
7 | type regidx = int | 8 | type regidx = int |
8 | type regval = int | 9 | type regval = int |
9 | type reg = Reg of regidx * regval | 10 | type reg = Reg of regidx * regval |
10 | 11 | ||
11 | type urmcmd = | 12 | type urmcmd = |
13 | | URMCopy of regidx * regidx | ||
14 | | URMJump of regidx * regidx * line | ||
15 | | URMSucc of regidx | ||
16 | | URMZero of regidx | ||
17 | |||
18 | type 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 | ||
17 | type instptr = InstPtr of (line * urmcmd) list * (line * urmcmd) list | 37 | type 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 | ||
44 | type state = { todo : int } | ||
45 | |||
24 | exception Syntax_error | 46 | exception 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 | |||
6 | open Common | ||
7 | |||
8 | val compile_preprocess : eurmcmd list -> eurmcmd list | ||
9 | val compile_stage1 : eurmcmd list -> state -> eurmcmd list * state | ||
10 | val compile_stage2 : eurmcmd list -> state -> eurmcmd list * state | ||
11 | val compile_stage3 : eurmcmd list -> state -> eurmcmd list * state | ||
12 | val compile_stage4 : eurmcmd list -> state -> urmcmd list * state | ||
13 | val urm_from_eurm : eurmcmd list -> urmcmd list | ||
14 | |||