\ Need this for tail call optimization
-: goto ( cfa -- )
- R> drop execute ;
-
-: goto-prime ( cfa -- )
- R> R> 2drop execute ;
+: goto-deferred ( cfa -- )
+ R> drop >body @ >body >R ;
include term-colours.4th
include defer-is.4th
+include catch-throw.4th
+
+defer read
+defer eval
+defer print
\ ------ Types ------
\ ---- Read ---- {{{
-defer read
-
variable parse-idx
variable stored-parse-idx
create parse-str 161 allot
\ ---- Eval ---- {{{
-defer eval
-
: self-evaluating? ( obj -- obj bool )
boolean-type istype? if true exit then
fixnum-type istype? if true exit then
2drop ( env body )
car 2swap ( exp env )
- ['] eval goto-prime \ Tail call optimization
- \ eval \ No tail call optimization
+ R> drop ['] eval goto-deferred \ Tail call optimization
endof
bold fg red ." Object not applicable. Aboring." reset-term cr
if-alternative
then
- 2swap ['] eval goto
+ 2swap
+ ['] eval goto-deferred
then
lambda? if
\ ---- Print ---- {{{
-defer print
-
: printnum ( numobj -- ) drop 0 .R ;
: printbool ( numobj -- )