aboutsummaryrefslogtreecommitdiff
path: root/common.mli
blob: 4fa838dfcffdb6b4cc43124ee4dc59b8c1257f48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(*
 * UPEM / L3 / Functional programming / Project: URM
 * Pacien TRAN-GIRARD, Adam NAILI
 *)

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
  | 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

type urm = {
  instptr : instptr;
  regs : reg list
}

type state = { todo : int }

exception Syntax_error