pinosaur
/
dotfiles.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6e3db62
)
cmks
author
Daniel Liu
<mr.picklepinosaur@gmail.com>
Sat, 5 Dec 2020 04:44:56 +0000
(23:44 -0500)
committer
Daniel Liu
<mr.picklepinosaur@gmail.com>
Sat, 5 Dec 2020 04:44:56 +0000
(23:44 -0500)
Scripts/cormackscript
patch
|
blob
|
history
diff --git
a/Scripts/cormackscript
b/Scripts/cormackscript
index
44c4a9f
..
9f7cc72
100755
(executable)
--- a/
Scripts/cormackscript
+++ b/
Scripts/cormackscript
@@
-9,25
+9,37
@@
# Place the comments (important to get spaces right too):
# ; CMKS START
# ; CMKS END
# Place the comments (important to get spaces right too):
# ; CMKS START
# ; CMKS END
-# into your racket program, the '
compi
led' code will be injected here.
+# into your racket program, the '
assemb
led' code will be injected here.
#
#
-# For extra niceness, if you have the racket program installed it will auto execute it.
+# For extra niceness, if you have the racket program installed it will auto execute it
your file
.
#
# A CormackScript file contains 3 columns separated by whitespace in the format [opcode|target|source]
#
# A CormackScript file contains 3 columns separated by whitespace in the format [opcode|target|source]
-# The inc, print and read instructions read from the first column
-# The quit instruction can be standalone
+# - The inc, print and read instructions read from the first column
+# - The quit instruction can be standalone
+# - you can comment with ;
+# - extraneous whitespace is ignored
#
# Here's some sample code
#
# Here's some sample code
+# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+# ; setting up memory
+# 6 ; [0]: first instruction
+# 1 ; [1]: literal 1
+# 2 ; [2]: literal 2
+# 7 ; [3]: literal 7
+# 0 ; [4]: n
+# 0 ; [5]: acc
#
#
-# mov 20 30
-# inc 1
-# read 21
-# print 21
+# ; actual instructions
+# read 4 ; input n
+# addeq 00 4 ; skip next if n = 0
+# add 00 2 ; skip next 2 instructions
+# print 5 ; out acc
# quit
# quit
+# add 05 04 ; acc = acc + n
+# sub 04 01 ; n = n - 1
+# sub 00 03 ; go back 7 (from next instr)
+# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
#
-# Note, for commands that only need one param you don't need to add empty columns
-# oh yeah, you can also comment with ;
-
# You can redefine these to whatever you want
inst0="inc" # [tt] = [tt] + 1
# You can redefine these to whatever you want
inst0="inc" # [tt] = [tt] + 1