1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-21 10:37:58 +03:00
Commit Graph

6 Commits

Author SHA1 Message Date
Ben Dudson
9cb9566897 Tidying, minimising differences between steps
Merging fixes in stepA into earlier steps, and
removing differences in comments and spacing
2018-01-04 16:07:01 +00:00
Ben Dudson
6df6dfd358 Fix memory leak, eval releases AST
Quasiquote (and macroexpand) replace the AST in eval.
This makes releasing the memory harder, so could give
rise to both double-frees, and memory leaks.

Eval now releases both its environment (for tail calls)
and the AST.
2017-11-29 15:13:10 +00:00
Ben Dudson
5ad295bd9d Fix cons and quasiquote functions
* Better handling of the final element in quasiquote

* Cons now increments reference counts of objects pointed to
  so they are not accidentally deleted

Now passes step7 tests again, including new test
2017-11-27 15:51:15 +00:00
Ben Dudson
8d054892e1 quasiquote tests pass
Needed to call quasiquote with first AST element,
which then wrapped symbol in (quote )

Two tests still failing. One for cons with empty list,
and another due to concat returning a vector
2017-11-23 00:06:34 +00:00
Ben Dudson
6b0641cbab Working on quasiquote. Not yet done
Quoting not yet working properly, so symbols in the input
AST are evaluated when they should not be.

Example failing test:

(quasiquote (1 a 3))

The quasiquote function turns this into

(cons 1 (cons a (quote (3))))

rather than

(cons 1 (cons (quote a) (quote (3))))
2017-11-22 23:29:46 +00:00
Ben Dudson
5fc8a017d9 Add quote special form
Just returns its argument unmodified, but some
differences in handling values and pointers needed.

Added generic Makefile rule, builds step7_quote
2017-11-18 23:12:38 +00:00