aboutsummaryrefslogtreecommitdiff
path: root/src/common.mli
blob: 16ffc874150f93bcd54096772b6b048fa7166b51 (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
48
49
(*
 * 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 = {
  max_reg : int;
  label_count : int
}

exception Syntax_error