+EXECUTE = defPrimWord("EXECUTE", () -> begin
+ reg.W = popPS()
+ return mem[reg.W]
+end)
+
+STATE, STATE_CFA = defNewVar("STATE", 0)
+
+INTERPRET = defWord("INTERPRET",
+ [LIT, 32, WORD, # Read next space-delimited word
+
+ DUP, FETCH, ZEQ, ZBRANCH, 3,
+ DROP, EXIT, # Exit if TIB is exhausted
+
+ STATE_CFA, FETCH, ZBRANCH, 26,
+ # Compiling
+ DUP, FIND, ZBRANCH, 17,
+
+ # Found word.
+ DUP, TOCFA, SWAP, INCR, FETCH, LIT, F_IMMED, AND, ZBRANCH, 4,
+ # Immediate: Execute!
+ EXECUTE, BRANCH, -30,
+
+ # Not immediate: Compile!
+ COMMA, BRANCH, -33,
+
+ # No word found, parse number
+ NUMBER, BTICK, LIT, COMMA, BRANCH, -39,
+
+ # Interpreting
+ DUP, FIND, ZBRANCH, 5,
+
+ # Found word. Execute!
+ TOCFA, EXECUTE, BRANCH, -47,
+
+ # No word found, parse number and leave on stack
+ NUMBER, BRANCH, -50,
+ EXIT]
+)
+
+PROMPT = defPrimWord("PROMPT", () -> begin
+ if (mem[STATE] == 0 and currentSource() == STDIN)
+ println(" ok")
+ end
+end)
+
+QUIT = defWord("QUIT",
+ [RSP0_CFA, RSPSTORE,
+ QUERY,
+ INTERPRET, PROMPT
+ BRANCH,-3])
+
+BYE = defPrimWord("BYE", () -> begin
+ return 0
+end)
+
+INCLUDE = defPrimWord("INCLUDE", () -> begin
+ callPrim(mem[WORD])