From 1b8fa63e3145a3778e065c42e9fc189344985c99 Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 21 Apr 2018 15:01:17 +0200 Subject: Add EURM interface --- common.mli | 27 +++++++++++++++++++++++++-- eurml.mli | 14 ++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 eurml.mli diff --git a/common.mli b/common.mli index a62b083..4fa838d 100644 --- a/common.mli +++ b/common.mli @@ -4,15 +4,35 @@ *) type line = int +type label = string type regidx = int type regval = int type reg = Reg of regidx * regval type urmcmd = + | URMCopy of regidx * regidx + | URMJump of regidx * regidx * line + | URMSucc of regidx + | URMZero of regidx + +type eurmcmd = + | Add of regidx * regidx + | Comment of string | Copy of regidx * regidx - | Jump of regidx * regidx * line - | Succ of regidx + | Dec of regidx + | EqPredicate of regidx * regidx * label + | GEqPredicate of regidx * regidx * label + | GTPredicate of regidx * regidx * label + | Goto of label + | Inc of regidx + | Label of label + | LEqPredicate of regidx * regidx * label + | LTPredicate of regidx * regidx * label + | Mult of regidx * regidx + | Quit + | Sub of regidx * regidx | Zero of regidx + | ZeroPredicate of regidx * label type instptr = InstPtr of (line * urmcmd) list * (line * urmcmd) list @@ -21,4 +41,7 @@ type urm = { regs : reg list } +type state = { todo : int } + exception Syntax_error + diff --git a/eurml.mli b/eurml.mli new file mode 100644 index 0000000..1b13dca --- /dev/null +++ b/eurml.mli @@ -0,0 +1,14 @@ +(* + * UPEM / L3 / Functional programming / Project: URM + * Pacien TRAN-GIRARD, Adam NAILI + *) + +open Common + +val compile_preprocess : eurmcmd list -> eurmcmd list +val compile_stage1 : eurmcmd list -> state -> eurmcmd list * state +val compile_stage2 : eurmcmd list -> state -> eurmcmd list * state +val compile_stage3 : eurmcmd list -> state -> eurmcmd list * state +val compile_stage4 : eurmcmd list -> state -> urmcmd list * state +val urm_from_eurm : eurmcmd list -> urmcmd list + -- cgit v1.2.3