From 2e0dd2bcf6d88acb79eeed1891d6c6a7fead9ed1 Mon Sep 17 00:00:00 2001 From: ProgramSnail Date: Sun, 20 Oct 2024 01:47:43 +0300 Subject: [PATCH 1/6] initial impl --- src/Expr.lama | 24 +++++++++++++++++++++++- src/SM.lama | 47 +++++++++++++++++++++++++++++++++++++++++++---- src/Stmt.lama | 14 +++++++++++++- 3 files changed, 79 insertions(+), 6 deletions(-) diff --git a/src/Expr.lama b/src/Expr.lama index b758035636..9ab7f0bd7f 100644 --- a/src/Expr.lama +++ b/src/Expr.lama @@ -13,6 +13,28 @@ import State; -- Const (int) | -- Binop (string, expr, expr) +public fun applyBinop(op, x, y) { + case op of + "+" -> (x + y) + | "-" -> (x - y) + | "*" -> (x * y) + | "/" -> (x / y) + | "%" -> (x % y) + | "<" -> (x < y) + | ">" -> (x > y) + | "<=" -> (x <= y) + | ">=" -> (x >= y) + | "==" -> (x == y) + | "!=" -> (x != y) + | "&&" -> (x && y) + | "!!" -> (x !! y) + esac +} + public fun evalExpr (st, expr) { - failure ("evalExpr not implemented\n") + case expr of + Var (x) -> st(x) + | Const (i) -> i + | Binop (op, e1, e2) -> applyBinop (op, evalExpr (st, e1), evalExpr (st, e2)) + esac } diff --git a/src/SM.lama b/src/SM.lama index 5e9e82bd9e..cbd610923e 100644 --- a/src/SM.lama +++ b/src/SM.lama @@ -11,7 +11,7 @@ import Fun; -- string representation. public fun showSMInsn (i) { case i of - READ -> sprintf ("READ") + READ (x) -> sprintf ("READ %s", x) | WRITE -> sprintf ("WRITE") | BINOP (s) -> sprintf ("BINOP %s", s) | LD (x) -> sprintf ("LD %s", x) @@ -24,10 +24,39 @@ public fun showSM (prg) { map (fun (i) {showSMInsn (i) ++ "\n"}, prg).stringcat } +fun evalRead (c) { + var newWorld; + newWorld := readWorld(c.snd.snd); + [newWorld.fst : c.fst, [c.snd.fst, newWorld.snd]] +} + +fun evalReadX (c, x) { + var newWorld; + newWorld := readWorld(c.snd.snd); + [c.fst, [c.snd.fst <- [x, newWorld.fst], newWorld.snd]] +} + +fun evalIns (c, i) { + -- TODO: assign val to var + -- READ (x) -> [readWorld (c.snd.snd).fst : c.fst, [c.snd.fst, readWorld (c.snd.snd).snd]] + case i of + READ -> evalRead (c) + | READ (x) -> evalReadX (c, x) + | WRITE -> [c.fst.tl, [c.snd.fst, writeWorld (c.fst.hd, c.snd.snd)]] + | BINOP (s) -> [applyBinop (s, c.fst.tl.hd, c.fst.hd) : c.fst.tl.tl, c.snd] + | LD (x) -> [c.snd.fst(x) : c.fst, c.snd] + | ST (x) -> [c.fst.tl, [c.snd.fst <- [x, c.fst.hd], c.snd.snd]] + | CONST (n) -> [n : c.fst, c.snd] + esac +} + -- Stack machine interpreter. Takes an SM-configuration and a program, -- returns a final configuration fun eval (c, insns) { - failure ("SM eval not implemented\n") + case insns of + i : insns_tail -> eval(evalIns(c, i), insns_tail) + | {} -> c + esac } -- Runs a stack machine for a given input and a given program, returns an output @@ -38,12 +67,22 @@ public fun evalSM (input, insns) { -- Compiles an expression into a stack machine code. -- Takes an expression, returns a list of stack machine instructions fun compileExpr (expr) { - failure ("compileExpr not implemented\n") + case expr of + Var (x) -> LD (x) + | Const (i) -> CONST (i) + | Binop (op, e1, e2) -> compileExpr(e1) : compileExpr (e2) : BINOP (op) + esac } -- Compiles a statement into a stack machine code. -- Takes a statement, returns a list of stack machine -- instructions. public fun compileSM (stmt) { - failure ("compileSM not implemented\n") + case stmt of + Assn (x, e) -> compileExpr (e) : ST (x) + | Seq (s1, s2) -> compileSM (s1) : compileSM (s2) + | Skip -> {} + | Read (x) -> READ (x) -- : ST (x) + | Write (e) -> compileExpr (e) : WRITE + esac } diff --git a/src/Stmt.lama b/src/Stmt.lama index 67ec6db9e6..dd0accd80a 100644 --- a/src/Stmt.lama +++ b/src/Stmt.lama @@ -16,8 +16,20 @@ import World; -- Read (string) | -- Write (expr) | +fun evalRead (c, x) { + var newWorld; + newWorld := readWorld(c.snd); + [(c.fst <- [x, newWorld.fst]), newWorld.snd] +} + fun eval (c, stmt) { - failure ("Stmt eval not implemented\n") + case stmt of + Assn (x, e) -> [c.fst <- [x, evalExpr (c.fst, e)], c.snd] + | Seq (s1, s2) -> eval (eval (c, s1), s2) + | Skip -> c + | Read (x) -> evalRead(c, x) + | Write (e) -> [c.fst, writeWorld (evalExpr (c.fst, e), c.snd)] + esac } -- Evaluates a program with a given input and returns an output From 865d62554a49ef0301bfd09b73c7ba830d50d5d4 Mon Sep 17 00:00:00 2001 From: ProgramSnail Date: Fri, 25 Oct 2024 22:02:09 +0300 Subject: [PATCH 2/6] fixes --- src/SM.lama | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/SM.lama b/src/SM.lama index cbd610923e..1012437378 100644 --- a/src/SM.lama +++ b/src/SM.lama @@ -1,4 +1,5 @@ -- Stack machine. +-- SM CONFIG: [STACK, [STATE, WORLD]] import List; import World; @@ -24,29 +25,29 @@ public fun showSM (prg) { map (fun (i) {showSMInsn (i) ++ "\n"}, prg).stringcat } -fun evalRead (c) { - var newWorld; - newWorld := readWorld(c.snd.snd); - [newWorld.fst : c.fst, [c.snd.fst, newWorld.snd]] -} +fun stack(x) { x[0] } -fun evalReadX (c, x) { +fun state(x) { x[1] } + +fun world(x) { x[2] } + +fun evalRead (c) { var newWorld; - newWorld := readWorld(c.snd.snd); - [c.fst, [c.snd.fst <- [x, newWorld.fst], newWorld.snd]] + newWorld := readWorld(c.world); + [newWorld.fst : c.stack, c.state, newWorld.snd] } fun evalIns (c, i) { - -- TODO: assign val to var - -- READ (x) -> [readWorld (c.snd.snd).fst : c.fst, [c.snd.fst, readWorld (c.snd.snd).snd]] case i of READ -> evalRead (c) - | READ (x) -> evalReadX (c, x) - | WRITE -> [c.fst.tl, [c.snd.fst, writeWorld (c.fst.hd, c.snd.snd)]] - | BINOP (s) -> [applyBinop (s, c.fst.tl.hd, c.fst.hd) : c.fst.tl.tl, c.snd] - | LD (x) -> [c.snd.fst(x) : c.fst, c.snd] - | ST (x) -> [c.fst.tl, [c.snd.fst <- [x, c.fst.hd], c.snd.snd]] - | CONST (n) -> [n : c.fst, c.snd] + | WRITE -> [c.stack.tl, c.state, writeWorld (c.stack.hd, c.world)] + | BINOP (s) -> + case c.stack of + x : y : tl -> [applyBinop (s, y, x) : tl, c.state, c.world] + esac + | LD (x) -> [state(c) (x) : c.stack, c.state, c.world] + | ST (x) -> [c.stack.tl, (c.state <- [x, c.stack.hd]), c.world] + | CONST (n) -> [n : c.stack, c.state, c.world] esac } @@ -68,9 +69,9 @@ public fun evalSM (input, insns) { -- Takes an expression, returns a list of stack machine instructions fun compileExpr (expr) { case expr of - Var (x) -> LD (x) - | Const (i) -> CONST (i) - | Binop (op, e1, e2) -> compileExpr(e1) : compileExpr (e2) : BINOP (op) + Var (x) -> { LD (x) } + | Const (i) -> { CONST (i) } + | Binop (op, e1, e2) -> compileExpr(e1) +++ compileExpr (e2) +++ { BINOP (op) } esac } @@ -79,10 +80,10 @@ fun compileExpr (expr) { -- instructions. public fun compileSM (stmt) { case stmt of - Assn (x, e) -> compileExpr (e) : ST (x) - | Seq (s1, s2) -> compileSM (s1) : compileSM (s2) + Assn (x, e) -> compileExpr (e) +++ { ST (x) } + | Seq (s1, s2) -> compileSM (s1) +++ compileSM (s2) | Skip -> {} - | Read (x) -> READ (x) -- : ST (x) - | Write (e) -> compileExpr (e) : WRITE + | Read (x) -> READ : { ST (x) } + | Write (e) -> compileExpr (e) +++ { WRITE } esac } From 0b0386f1d100c1d2e71dee00d4e25ec43ed9c1e2 Mon Sep 17 00:00:00 2001 From: ProgramSnail Date: Fri, 15 Nov 2024 21:20:47 +0300 Subject: [PATCH 3/6] HW2: x86_64 --- src/X86_64.lama | 50 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/src/X86_64.lama b/src/X86_64.lama index 9c03745cb8..9db906d110 100644 --- a/src/X86_64.lama +++ b/src/X86_64.lama @@ -285,6 +285,25 @@ fun suffix (op) { esac } +fun asmOp (op) { + var cmp_op = "cmp"; + case op of + "+" -> "+" + | "-" -> "-" + | "*" -> "*" + | "/" -> "/" + | "%" -> "%" + | "<" -> cmp_op + | ">" -> cmp_op + | "<=" -> cmp_op + | ">=" -> cmp_op + | "==" -> cmp_op + | "!=" -> cmp_op + | "&&" -> "&&" + | "||" -> "||" + esac +} + -- Compiles stack machine code into a list of x86 instructions. Takes an environment -- and stack machine code, returns an updated environment and x86 code. fun compile (env, code) { @@ -300,6 +319,35 @@ fun compile (env, code) { case env.pop of [s, env] -> [env, code <+ Mov (s, rdi) <+ Call ("Lwrite")] esac + | BINOP (op) -> + case asmOp (op) of + "/" -> case env.pop2 of + [x, y, env] -> [env.push (x), code <+ Mov (x, rax) <+ Cltd <+ IDiv (y) <+ Mov (rax, x)] + esac + | "%" -> case env.pop2 of + [x, y, env] -> [env.push (x), code <+ Mov (x, rax) <+ Cltd <+ IDiv (y) <+ Mov (rdx, x)] + esac + | "cmp" -> case env.pop2 of + [x, y, env] -> [env.push (x), code <+ Binop ("cmp", x, y) <+ Set (op, x)] + esac + | asm_op -> case env.pop2 of + [x, y, env] -> [env.push (x), code <+ Binop (asm_op, x, y)] + esac + esac + | CONST (n) -> + case env.allocate of + [s, env] -> [env, code <+ Mov (L (n), s)] + esac + | LD (x) -> + case env.allocate of + [s, env] -> [env, code <+ Mov (env.loc (x), s)] + esac + | ST (x) -> + case env.addGlobal (x) of + env -> case env.pop of + [s, env] -> [env, code <+ Mov (s, env.loc (x))] + esac + esac | _ -> failure ("codegeneration for instruction %s is not yet implemented\n", i.string) esac }, [env, emptyBuffer ()], code) @@ -322,4 +370,4 @@ public fun compileX86 (code) { ) ).stringcat esac -} \ No newline at end of file +} From bfa7ebd1e9d6a74eedaca57fe973a6884c4d92f6 Mon Sep 17 00:00:00 2001 From: ProgramSnail Date: Sat, 16 Nov 2024 01:18:19 +0300 Subject: [PATCH 4/6] fixes --- src/X86_64.lama | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/X86_64.lama b/src/X86_64.lama index 9db906d110..f2121e5289 100644 --- a/src/X86_64.lama +++ b/src/X86_64.lama @@ -300,7 +300,7 @@ fun asmOp (op) { | "==" -> cmp_op | "!=" -> cmp_op | "&&" -> "&&" - | "||" -> "||" + | "!!" -> "!!" esac } @@ -322,17 +322,37 @@ fun compile (env, code) { | BINOP (op) -> case asmOp (op) of "/" -> case env.pop2 of - [x, y, env] -> [env.push (x), code <+ Mov (x, rax) <+ Cltd <+ IDiv (y) <+ Mov (rax, x)] + [x, y, env] -> [env.push (y), code <+ Mov (x, rax) <+ Cltd <+ IDiv (y) <+ Mov (rax, x)] esac | "%" -> case env.pop2 of - [x, y, env] -> [env.push (x), code <+ Mov (x, rax) <+ Cltd <+ IDiv (y) <+ Mov (rdx, x)] + [x, y, env] -> [env.push (y), code <+ Mov (x, rax) <+ Cltd <+ IDiv (y) <+ Mov (rdx, x)] esac | "cmp" -> case env.pop2 of - [x, y, env] -> [env.push (x), code <+ Binop ("cmp", x, y) <+ Set (op, x)] + [x, y, env] -> [env.push (y), code <+ Binop("^", rax, rax) + <+ Binop ("cmp", x, y) <+ Set (suffix (op), "%al") + <+ Mov (rax, x)] esac + | "!!" -> case env.pop2 of + [x, y, env] -> [env.push (y), code -- <+ Mov (L(0), rax) + <+ Binop("^", rax, rax) + <+ Binop("^", rdx, rdx) + <+ Binop ("cmp", x, rax) <+ Set (suffix ("!="), "%dl") + <+ Binop ("cmp", y, rax) <+ Set (suffix ("!="), "%al") + <+ Binop ("!!", rdx, rax) + <+ Mov (rax, x)] + esac + | "&&" -> case env.pop2 of + [x, y, env] -> [env.push (y), code -- <+ Mov (L(0), rax) + <+ Binop("^", rax, rax) + <+ Binop("^", rdx, rdx) + <+ Binop ("cmp", x, rax) <+ Set (suffix ("!="), "%dl") + <+ Binop ("cmp", y, rax) <+ Set (suffix ("!="), "%al") + <+ Binop ("&&", rax, rdx) + <+ Mov (rax, x)] + esac | asm_op -> case env.pop2 of - [x, y, env] -> [env.push (x), code <+ Binop (asm_op, x, y)] - esac + [x, y, env] -> [env.push (y), code <+ Binop (asm_op, x, y)] + esac esac | CONST (n) -> case env.allocate of From f049b72fe4a9b1d07d6b705bf3ea05d42d1fd3ee Mon Sep 17 00:00:00 2001 From: ProgramSnail Date: Sat, 16 Nov 2024 10:00:32 +0300 Subject: [PATCH 5/6] final fixes for hw2 --- src/X86_64.lama | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/X86_64.lama b/src/X86_64.lama index f2121e5289..94ea800fae 100644 --- a/src/X86_64.lama +++ b/src/X86_64.lama @@ -322,15 +322,15 @@ fun compile (env, code) { | BINOP (op) -> case asmOp (op) of "/" -> case env.pop2 of - [x, y, env] -> [env.push (y), code <+ Mov (x, rax) <+ Cltd <+ IDiv (y) <+ Mov (rax, x)] + [x, y, env] -> [env.push (y), code <+ Mov (y, rax) <+ Cltd <+ IDiv (x) <+ Mov (rax, y)] esac | "%" -> case env.pop2 of - [x, y, env] -> [env.push (y), code <+ Mov (x, rax) <+ Cltd <+ IDiv (y) <+ Mov (rdx, x)] + [x, y, env] -> [env.push (y), code <+ Mov (y, rax) <+ Cltd <+ IDiv (x) <+ Mov (rdx, y)] esac | "cmp" -> case env.pop2 of [x, y, env] -> [env.push (y), code <+ Binop("^", rax, rax) <+ Binop ("cmp", x, y) <+ Set (suffix (op), "%al") - <+ Mov (rax, x)] + <+ Mov (rax, y)] esac | "!!" -> case env.pop2 of [x, y, env] -> [env.push (y), code -- <+ Mov (L(0), rax) @@ -339,7 +339,7 @@ fun compile (env, code) { <+ Binop ("cmp", x, rax) <+ Set (suffix ("!="), "%dl") <+ Binop ("cmp", y, rax) <+ Set (suffix ("!="), "%al") <+ Binop ("!!", rdx, rax) - <+ Mov (rax, x)] + <+ Mov (rax, y)] esac | "&&" -> case env.pop2 of [x, y, env] -> [env.push (y), code -- <+ Mov (L(0), rax) @@ -348,7 +348,7 @@ fun compile (env, code) { <+ Binop ("cmp", x, rax) <+ Set (suffix ("!="), "%dl") <+ Binop ("cmp", y, rax) <+ Set (suffix ("!="), "%al") <+ Binop ("&&", rax, rdx) - <+ Mov (rax, x)] + <+ Mov (rax, y)] esac | asm_op -> case env.pop2 of [x, y, env] -> [env.push (y), code <+ Binop (asm_op, x, y)] From 646a291242db049b032586acf172dafa0e7d6f8a Mon Sep 17 00:00:00 2001 From: ProgramSnail Date: Fri, 15 Nov 2024 21:28:12 +0300 Subject: [PATCH 6/6] read print fix --- regression/test001.run | Bin 0 -> 18736 bytes src/SM.lama | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100755 regression/test001.run diff --git a/regression/test001.run b/regression/test001.run new file mode 100755 index 0000000000000000000000000000000000000000..bc9ea7c8e6068e47b8c275bd483592add61b178a GIT binary patch literal 18736 zcmeHPeQX@X6`#HH*_SxB&oK%4tS>YP3Bvc`Tx`d|$vKXlGj)iGLqbYnv%XvVw!IH` zZ_n6-LJ-j62HGH1?H|oQ{6nRx6;y2{BqA_`CV*&3s8pr@6sszg5rl$DQA!cl_h#np zotH~MEvhQ913Pcto8NC{_U+t!taoy6|ImO(Q5Xde+rdy94#c@h#Ed<;ldIC!#TrXDi%lHDhhHH$Gq!yw?UOB{NQpmJVs3ciH z=*Z()QfKo1NM4i`kgVkK`huby7L1F8lpjem$x0sj=2DvgTplKhEn#H&mCv&$=ZB!yOfPEOvGImTwuMtp@S3v`dv0m1`fuYwERj{J4MUVCoo z8?9YO550UUJM!9X^{=1*D`N0IuuQ~YKsjG-z$*X3>JFsR~tqH{vx(WTXB`K2))-M^uL+DN(HV8U~ z3p?XnVjn}_P?)Q*%b$qIipROEgShf}_$%!A{M_Jr!1aLZ0oMbr2V4)h9&kP2df@-b z1AlM&(uaxr-}Wbt`_6|MOFTGhc}nLJ_rKsj&6`=;`ZAbH8(x99sWlEM)YF*v=3EKF zhUZboCG(r-K*jQ+7YAp~-;tR4bK?HLygPiLKR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M=o~)1r{PA35L+3(3<_>jJkm(#%jw*C zT-r(SjSVRvJK(D1(>ZfGe@^=eqR_ZXI_|qF`Lu30DVM@Q0!r!R%Q2Pl-@*c>;cU7d*`>GcuKaOMw&h`r{V~;=rp~Sb}kI9KEB7s!D z^Zs$Ciu_#?NAKIZs_-*^8H{27t_wgJyD*3~~IL8hLx!|u0L`uZ;{K@uvNWkWu{|3-T z>t_1*8Ju|1N#Z)Tse*5>)8Xt32EqxgtdspM$iTiMf3EiWmj1nsb9i$Qu>WHq9zDnR z!G;jx)4v;VA&h9d8wv$t;*AEM?hH)sU$Z*f}RaR zB1hsJc_GRL+f6{B^07uHx!4Z*4hXjg@r?_FBRnogfpU_kaKBNFe@ybjj!cKj4qk@; zg#6*nIqGxrQi0B%E&?0%UBM9XrW=I(kSday4i)xn)%n-#5QO6nfg{Qv*} literal 0 HcmV?d00001 diff --git a/src/SM.lama b/src/SM.lama index 1012437378..9ae7982f19 100644 --- a/src/SM.lama +++ b/src/SM.lama @@ -12,7 +12,7 @@ import Fun; -- string representation. public fun showSMInsn (i) { case i of - READ (x) -> sprintf ("READ %s", x) + READ -> sprintf ("READ") | WRITE -> sprintf ("WRITE") | BINOP (s) -> sprintf ("BINOP %s", s) | LD (x) -> sprintf ("LD %s", x)