Instructions I
Potentially useful functions:
string-contains?
string-split
substring
string-replace
string-append
Optional:
- Package: match-string
Goal
We want to be break a instruction string into three separate pieces: the destination, the operation, and the jump/comparison.
- Destination: the register(s) where the result goes.
- Operation: the computation performed by the ALU, like
A+1
orM&D
. - Jump comparison:
JMP
,JLE
etc.
Your end goal is to take in an instruction string and produce a list
of strings with three components: (list destination operation jump)
.
Warmup
Write examples of what should be produced in these situations:
DM=M+1;JMP
A=D-1
M=0
D;JLE
0;JMP
Write two more examples that you make up.
Coding
Turn your examples in check-expects.