Crowlang / crow

Crow Lisp
MIT License
6 stars 2 forks source link

Function defined but not being found when called #56

Open Nodnarb12500 opened 1 year ago

Nodnarb12500 commented 1 year ago

creating several functions in crow and calling them doesnt work

(defvar result)
;;(defvar x)
;;(defvar y)

;;(set x (getln))
;;(set y (getln))

(defun mathAdd (x y)
    (set result (+ x y))
    (println result)
)
(mathAdd 9 5)

(defun mathSub (x y)
    (set result (- x y))
    (println result)
)
(mathSub 4 8)

(defun mathMul (x y)
    (set result (* x y))
    (println result)
)
(mathMul -20 60)

(defun mathDiv (x y) 
    (set result (/ x y))
    (println result)
)
(mathDiv 300 30)

Variable 'mathDiv' is not defined

Bravotic commented 1 year ago

This is most likely a garbage collector issue, I would suspect it is related to the new system.

Bravotic commented 1 year ago

Okay this issue looks like its actually coming from the parser, it seems like removing the commented out parts makes everything work. I will look back at the comment system. Seemed to work when i pasted it into the REPL however, so maybe I can uplift some code from there.

Nodnarb12500 commented 1 year ago

yeah code works without comments for me to

Bravotic commented 1 year ago

Depends #58