Execute Computer/Zero: Difference between revisions
m
J: maybe less concise overall but maybe easier to read (and relatively concise single line assembly)
m (J: more concise) |
m (J: maybe less concise overall but maybe easier to read (and relatively concise single line assembly)) |
||
Line 133:
assemble=: {{
acc=: pc=: 0
delim=. {.((tolower y)-.(":i.10),;OPS),LF
y=. delim cut y
end.
code=. assemble1@> y
mem=: code (i.#code)} 32#0
}}
Line 160 ⟶ 164:
With this implementation, we can assemble and run representations of the five suggested programs:
<lang J> exec assemble 'LDA 3
4
exec assemble
56
exec assemble
55
exec assemble
6
exec assemble
0</lang>
|