Scriptor / pharen

Lisp to PHP Compiler
http://pharen.org
BSD 3-Clause "New" or "Revised" License
218 stars 31 forks source link

Compile errors #60

Closed vendethiel closed 9 years ago

vendethiel commented 10 years ago

Hey! Pharen looks interesting, but I'm getting some compile errors:

(defmacro foreach (var args & body)
   '(do @~body))

(foreach a b (echo a))

Gives:

Notice: Trying to get property of non-object in pharen.php on line 2620

Parse error: parse error, expecting `"identifier (T_STRING)"' or `'('' in pharen.php(2637) : eval()'d code on line 2

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'foreach' not found or invalid function name in pharen.php on line 1127

(defmacro foreach (var args & body)
   '(do ~@body))

(foreach a b (echo a))

Gives: Fatal error: Call to a member function add_child() on a non-object in pharen.php on line 3987

vendethiel commented 10 years ago

Note: that doesn't seem to be related to use of the "foreach" name.

vendethiel commented 10 years ago

I'm really not getting the hang of it:

pharen.repl> (defmacro my-do (&args) (do ~@body)) ;; missing quote here
"pharen\repl\my_do"
pharen.repl> (my-do (printf "a") (printf "b"))

Warning: array_pop() expects parameter 1 to be array, boolean given in pharen.php on line 2967

Warning: Invalid argument supplied for foreach() in pharen.php on line 2968

Fatal error: Call to a member function compile_return() on a non-object in pharen.php on line 2974
pharen.repl> (defmacro my-do (&args) '(do ~@body))
"pharen\repl\my_do"
pharen.repl> (my-do (printf "a") (printf "b"))

Warning: Invalid argument supplied for foreach() in pharen.php on line 2783

Notice: Undefined variable: __dotmpvar1 in repl.php(224) : eval()'d code on line 10
Null