INTERPRET = defPrim("INTERPRET", () -> begin
callPrim(mem[WORD])
+
+ wordName = getString(mem[reg.PSP-1], mem[reg.PSP])
+ println("... ", replace(wordName, "\n", "\\n"), " ...")
+
callPrim(mem[TWODUP])
callPrim(mem[FIND])
wordAddr = mem[reg.PSP]
+
if wordAddr>0
# Word in dictionary
popPS()
- wordName = getString(mem[reg.PSP-1], mem[reg.PSP])
-
callPrim(mem[NUMBER])
if popPS() != 0
BRANCH,-2])
NL = defPrim("\n", () -> begin
- println(" ok")
+ if mem[STATE] == 0
+ println(" ok")
+ end
return mem[NEXT]
end)
# Primitive processing loop.
# Everyting else is simply a consequence of this loop!
jmp = mem[NEXT]
- while (jmp = callPrim(jmp)) != 0 end
+ while (jmp = callPrim(jmp)) != 0
+ println("Evaluating prim $jmp")
+ end
end
# Debugging tools