New tools.interpreter.debug vocab for interactively testing single stepper

release
Slava 2007-10-03 18:53:13 -04:00
parent e950e03c99
commit d37a17bd68
2 changed files with 19 additions and 13 deletions

View File

@ -0,0 +1,17 @@
! Copyright (C) 2004, 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.interpreter namespaces kernel arrays continuations
threads sequences ;
IN: tools.interpreter.debug
: run-interpreter ( -- )
interpreter get [ step-into run-interpreter ] when ;
: init-interpreter ( quot -- )
[
"out" set
[ f swap 2array restore "out" get continue ] callcc0
] swap [ datastack "datastack" set stop ] 3append callcc0 ;
: test-interpreter ( quot -- )
init-interpreter run-interpreter "datastack" get ;

View File

@ -1,22 +1,11 @@
USING: tools.interpreter io io.streams.string kernel math
math.private namespaces prettyprint sequences tools.test
continuations math.parser threads arrays ;
continuations math.parser threads arrays
tools.interpreter.debug ;
IN: temporary
[ "Ooops" throw ] break-hook set
: run-interpreter ( -- )
interpreter get [ step-into run-interpreter ] when ;
: init-interpreter ( quot -- )
[
"out" set
[ f swap 2array restore "out" get continue ] callcc0
] swap [ datastack "datastack" set stop ] 3append callcc0 ;
: test-interpreter ( quot -- )
init-interpreter run-interpreter "datastack" get ;
[ { } ] [
[ ] test-interpreter
] unit-test