sasagawa888 / eisl

ISLisp interpreter/compiler
Other
267 stars 22 forks source link

Compile error #310

Closed sasagawa888 closed 3 months ago

sasagawa888 commented 3 months ago
(defun tarai* (x y z)
    (dtarai (delay x) (delay y) (delay z)))

(defun dtarai (x y z)
    (if (<= (force x) (force y))
        (force y)
        (dtarai (delay (dtarai (delay (- (force x) 1)) y z))
                (delay (dtarai (delay (- (force y) 1)) z x))
                (delay (dtarai (delay (- (force z) 1)) x y)))))

initialize
pass1
pass2
compiling TARAI* 
compiling DTARAI 
compile error undefined global variable X 
T
> 
sasagawa888 commented 3 months ago

The delay is achieved by generating lambda. The compiler sexually compiles lambda. This does not function as a delay object. It is a constraint of the current compilation method. It works well only in the interpreter.