From fa2e69bf68346d653d194d863c019674ea0fd7e2 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Wed, 8 Jan 2014 18:17:03 +0100 Subject: Premier mail emile --- asm/asm.ml | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 asm/asm.ml (limited to 'asm/asm.ml') diff --git a/asm/asm.ml b/asm/asm.ml new file mode 100644 index 0000000..5a3a96b --- /dev/null +++ b/asm/asm.ml @@ -0,0 +1,95 @@ +type reg = int + +type imm = + | Imm of int + | Lab of string + | Labu of string + +type fmt_r = + | Add + | Sub + | Mul + | Div + | Addu + | Subu + | Mulu + | Divu + | Or + | And + | Xor + | Nor + | Lsl + | Lsr + | Asr + | Se + | Sne + | Sle + | Slt + | Sltu + | Sleu + | Jer + | Jner + | Jltr + | Jler + | Jltru + | Jleru + | Lwr + | Swr + | Lbr + | Sbr + +type instr = + | R of (fmt_r * reg * reg * reg) + | Incri of (reg * int) + | Shi of (reg * int) + | J of imm + | Jal of imm + | Jr of reg + | Jalr of reg + | Lw of (reg * reg * int) + | Sw of (reg * reg * int) + | Lb of (reg * reg * int) + | Sb of (reg * reg * int) + | Lil of (reg * imm) + | Lilz of (reg * imm) + | Liu of (reg * imm) + | Liuz of (reg * imm) + | Lra of imm + +module Imap = Map.Make(String) + +type program = { text : instr list; data : (int * bool) list; lbls : int Imap.t } + +let keywords_r = [ + "add",Add; + "sub",Sub; + "mul",Mul; + "div",Div; + "addu",Addu; + "subu",Subu; + "mulu",Mulu; + "divu",Divu; + "or",Or; + "and",And; + "xor",Xor; + "nor",Nor; + "lsl",Lsl; + "Asr",Asr; + "Lsr",Lsr; + "se",Se; + "sne",Sne; + "sle",Sle; + "slt",Slt; + "sltu",Sltu; + "sleu",Sleu; + "jer",Jer; + "jner",Jner; + "jltr",Jltr; + "jler",Jler; + "jltru",Jltru; + "jleru",Jleru; + "lwr",Lwr; + "lbr",Lbr; + "swr",Swr; + "sbr",Sbr + ] -- cgit v1.2.3 From 1f228ce77e8a71475930b433fb2c72521203aa99 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Wed, 8 Jan 2014 18:19:21 +0100 Subject: Petites modifications --- asm/asm.ml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'asm/asm.ml') diff --git a/asm/asm.ml b/asm/asm.ml index 5a3a96b..7df7604 100644 --- a/asm/asm.ml +++ b/asm/asm.ml @@ -1,3 +1,5 @@ +exception Asm_error of string + type reg = int type imm = @@ -55,6 +57,7 @@ type instr = | Liu of (reg * imm) | Liuz of (reg * imm) | Lra of imm + | TwoRawBytes of (int * int) module Imap = Map.Make(String) -- cgit v1.2.3 From 91bc6bd5554bb4267cbaf147e603791e50462242 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Wed, 8 Jan 2014 18:20:58 +0100 Subject: 2e mail Emile --- asm/asm.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'asm/asm.ml') diff --git a/asm/asm.ml b/asm/asm.ml index 5a3a96b..8404654 100644 --- a/asm/asm.ml +++ b/asm/asm.ml @@ -3,7 +3,6 @@ type reg = int type imm = | Imm of int | Lab of string - | Labu of string type fmt_r = | Add @@ -58,7 +57,8 @@ type instr = module Imap = Map.Make(String) -type program = { text : instr list; data : (int * bool) list; lbls : int Imap.t } +type program = { text : instr list; data : (int * bool) list; + lbls : (int * bool) Imap.t } let keywords_r = [ "add",Add; -- cgit v1.2.3