Crowlang/crow

comments dont work in this example or comments break it

Opened this issue · 2 comments

tried to print out a file and it didnt work. the file being read does not contain any ; but it does contain really old crowlang examples.

;;test comment
(defvar file (open "./README.org"))
;;read file
(read file)

error: Variable ';' is not defined

;;test comment
(defvar file (open "./README.org"))
;;read and print file
(println (read file))

error: Variable 'file' is not defined
the example above works without the comment

the error also changes if theres a comment above the code your trying to execute

(defvar file (open "./README.org"))
;;read and print file
(println (read file))

error: Variable '' is not defined

The file being read:

#+title: Crowlang Examples
#+DESCRIPTION: examples that should work everywhere to test crow lang on several different computers
#+AUTHOR: nodnarb12500




* CrowLang Examples
** Loops
*** Infinite Loop

#+begin_src lisp :tangle infinite-loop.cro

(defvar x 0)

(loop ({
	(println x)
	(set x (+ x 1))
))

#+end_src

*** While Loop

#+begin_src lisp :tangle temp-loop.cro

(defvar x 0)

(while (!= x 5000) ({
	(println x)
	(set x (+ x 1))
))

#+end_src

** Math
*** Calculator Idea
doesnt work yet cant convert dtring to integers yet

#+begin_src lisp :tangle multiMath-test.cro

(defvar result)

(defvar mathAdd (func (x, y) ({
		(set result (+ x y))
		(println result)

)))

(defvar mathSub (func (x, y) ({
		(set result (- x y))
		(println result)

)))

(defvar mathMul (func (x, y) ({
		(set result (* x y))
		(println result)

)))

(defvar mathDiv (func (x, y) ({
		(set result (/ x y))
		(println result)

)))

(mathAdd 9 5)
(mathSub result 8)
(mathMul result 60)
(mathDiv result 30)

#+end_src

i tried another file with just the test "test file" in it and it still gave the same errors

Confirmed that this is not a regression related to the garbage collection overhaul, which is good. Going to investigate the cause.