diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2023-02-11 09:40:25 -0800 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2023-02-11 09:40:25 -0800 |
| commit | ddb69212f03a82e980144594d809a072b50e7f19 (patch) | |
| tree | feffd8402d40c8ee0c3bb441355db956ef4cc6f9 /syntax.sml | |
| parent | b3f2fd686bc781996687deaadbe721b3300e4aba (diff) | |
| download | sml-ddb69212f03a82e980144594d809a072b50e7f19.tar.zst | |
Finish the compiler.
Just joking. But we did manage to compile a program from SML
to bytecode.
Diffstat (limited to 'syntax.sml')
| -rw-r--r-- | syntax.sml | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -125,4 +125,14 @@ struct end val cexpToString : cexp -> string = cexpToStringI "" + + fun opcodeToString (oper : opcode) : string = + case oper of + OAlloc (r, s) => "OAlloc (" ^ Int.toString r ^ ", " ^ valueToString s ^ ")" + | OCall => "OCall" + | OPoke (i, p, v) => "OPoke (" ^ Int.toString i ^ ", " ^ Int.toString p ^ ", " ^ valueToString v ^ ")" + | OPeek (r, i, p) => "OPeek (" ^ Int.toString r ^ ", " ^ Int.toString i ^ ", " ^ valueToString p ^ ")" + | OShuf (d, s) => "OShuf (" ^ Int.toString d ^ ", " ^ valueToString s ^ ")" + | OExit v => "OExit " ^ valueToString v + | OLabel l => "OLabel " ^ Int.toString l end |
