\ test scaffolding : 'c ( "name" -- xt ) \ like ', but report exception >in @ ['] ' catch dup if ." ' " swap >in ! parse-name type ." throws " . 1 throw then drop nip ; : ex ( ... xt -- ... ) \ like execute, but report exception ['] execute catch dup if ." execute throws " . 1 throw then drop ; : ]ex ] ex ; : ]c, ( ... xt -- ... ) \ like ] compile,, but report exception ] ['] compile, catch dup if ." compile, throws " . 1 throw then drop ; : ev ( ... c-addr u -- ... ) cr 2dup type ." ==> " ['] evaluate catch dup if dup 1 <> if ." ev throws " . then else drop depth if cr ." unexpected value(s) on the stack" .s then then postpone [ begin depth while drop repeat ; \ if s\" : tif [ 'c if ex ] .\" bla\" then ; \\ executes compilation semantics?" ev s" 0 tif" ev s" 1 tif \ bla" ev \ r@ : tr@ex >r execute . r> ; s" 'c r@ 1 tr@ex drop \ 1" ev s" 'c r@ constant r@xt" ev s" : tr@c, >r [ r@xt ]c, . r> ;" ev s" 1 tr@c, drop \ 1" ev \ exit s" 'c exit constant exitxt" ev : texitex 1 . execute 2 . ; s" 'c exit texitex \ execution: 1" ev s" : texitex2 1 . [ exitxt execute ] 2 . ; texitex2 \ compilation: 1" ev \ s" : texitc, 1 . [ exitxt ]c, 2 . ;" ev s" : texitc, 1 . [ exitxt compile, ] 2 . ;" ev s" texitc, \ 1" ev \ compile, s" 'c compile, constant c,xt" ev s" : tcompile,ex : ['] . c,xt ex postpone ; ;" ev s" tcompile,ex tcompile,ex1" ev s" 1 tcompile,ex1 \ 1" ev s" : tcompile,]c,1 c,xt ]c, ;" ev s" : tcompile,c,2 : ['] . [ tcompile,]c,1 postpone ; ;" ev s" tcompile,c,2 tcompile,c,3" ev s" 1 tcompile,c,3 \ 1" ev \ s" s\" 'c s\" constant sqxt" ev s\" sqxt ex foo1\" type \\ foo1" ev s\" : tsqex1 [ sqxt ]ex foo2\" [ type ] ; \\ interpretation: foo2" ev s\" : tsqex2 [ sqxt ]ex foo3\" ;" ev s\" tsqex2 type \\ state-smart: foo3" ev s\" : tsqc,1 [ sqxt ]c, ; immediate" ev s\" : tsqc,2 tsqc,1 foo4\" [ type ] ; \\ interpretation: foo4 " ev s\" : tsqc,3 tsqc,1 foo5\" ;" ev s\" tsqc,3 type \\ state-smart: foo5" ev \ to s" 'c to constant toxt" ev s" 0 value val1" ev s" 4 toxt ex val1 val1 . \ 4" ev s" : tto1 [ 5 toxt ]ex val1 ; val1 . \ interpretation: 5" ev s" : tto2 6 [ toxt ]ex val1 ; val1 . tto2 val1 . \ state-smart: 4 6" ev s" : tto3 [ toxt ]c, ; immediate" ev s" 7 tto3 val1 val1 . \ interpretation: 7" ev s" : tto4 [ 8 ] tto3 val1 ; val1 . \ interpretation: 8" ev s" : tto5 9 tto3 val1 ; val1 . tto5 val1 . \ state-smart: 7 9" ev cr