\ ==== Evaluation ==== {{{
-\ :noname ( args -- result )
-\ 2dup car 2swap cdr
-\
-\ nil? false = if car then ( proc argvals )
-\
-\ apply
-\ ; make-primitive apply
+:noname ( args -- result )
+ 2dup car 2swap cdr
+
+ nil? false = if car then ( proc argvals )
+
+ 2swap apply
+; make-primitive apply
\ }}}
exit
then
+ nextchar [char] ) = if
+ inc-parse-idx
+ except-message: ." unmatched closing parenthesis." recoverable-exception throw
+ then
+
\ Anything else is parsed as a symbol
readsymbol charlist>symbol
\ }}}
-\ ---- Eval ---- {{{
+\ ---- Syntax ---- {{{
: self-evaluating? ( obj -- obj bool )
boolean-type istype? if true exit then
\ }}}
-\ ---- Analyze ----
+\ ---- Analyze ---- {{{
: evaluate-eproc ( eproc env --- res )
then
;
-: application-executor ( operator-proc arg-procs env -- res )
- 2rot 2over ( aprocs env fproc env )
- evaluate-eproc ( aprocs env proc )
-
- -2rot 2swap ( proc env aprocs )
- evaluate-operand-eprocs ( proc vals )
-
- 2swap ( vals proc )
-
+: apply ( vals proc )
dup case
primitive-proc-type of
drop execute
endcase
;
+: application-executor ( operator-proc arg-procs env -- res )
+ 2rot 2over ( aprocs env fproc env )
+ evaluate-eproc ( aprocs env proc )
+
+ -2rot 2swap ( proc env aprocs )
+ evaluate-operand-eprocs ( proc vals )
+
+ 2swap ( vals proc )
+
+ ['] apply goto
+;
+
: analyze-application ( exp -- eproc )
2dup operator analyze
2swap operands operand-eproc-list
; is analyze
+\ }}}
\ ---- Macro Expansion ---- {{{