The Lambda Lab
/
projects
/
forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
eb93827
)
Debugging DOCOL
author
Tim Vaughan
<tgvaughan@gmail.com>
Sat, 23 Apr 2016 12:37:58 +0000
(
00:37
+1200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Sat, 23 Apr 2016 12:37:58 +0000
(
00:37
+1200)
src/forth.jl
patch
|
blob
|
history
diff --git
a/src/forth.jl
b/src/forth.jl
index
0c9cf4f
..
4b625bc
100644
(file)
--- a/
src/forth.jl
+++ b/
src/forth.jl
@@
-31,6
+31,7
@@
size_TIB = 1096 # Terminal input buffer size
mem = Array{Int64,1}(size_mem)
primitives = Array{Function,1}()
mem = Array{Int64,1}(size_mem)
primitives = Array{Function,1}()
+primNames = Array{ASCIIString,1}()
# Built-in variables
# Built-in variables
@@
-127,6
+128,8
@@
function defPrim(name::AbstractString, f::Function; flags::Int64=0)
mem[codeWordAddr] = -length(primitives)
mem[HERE] += 1
mem[codeWordAddr] = -length(primitives)
mem[HERE] += 1
+ push!(primNames, name)
+
return codeWordAddr
end
return codeWordAddr
end
@@
-878,7
+881,7
@@
function runVM()
# Everyting else is simply a consequence of this loop!
jmp = mem[NEXT]
while (jmp = callPrim(jmp)) != 0
# Everyting else is simply a consequence of this loop!
jmp = mem[NEXT]
while (jmp = callPrim(jmp)) != 0
- println("Evaluating prim $jmp")
+ println("Evaluating prim $jmp
[$(primNames[-jmp])]
")
end
end
end
end