Add beginning of Lips compiler, DynASM
diff --git a/src/lisp/lisp.c b/src/lisp/lisp.c
index 8be2b4c..51a3270 100644
--- a/src/lisp/lisp.c
+++ b/src/lisp/lisp.c
@@ -176,7 +176,7 @@
{
printf ("list:\n");
- for (struct value n = v; !nilp (n); n = cdr (n))
+ for ( struct value n = v; !nilp (n); n = cdr (n) )
{
printval (car (n), depth + 1);
}
@@ -384,8 +384,7 @@
{
struct value *next = &v;
- while ( next->tag.type == T_CONS &&
- cdr(*next).tag.type == T_CONS )
+ while ( next->tag.type == T_CONS && cdr (*next).tag.type == T_CONS )
{
next = &next->value.cons_val->cdr;
}
@@ -413,3 +412,13 @@
{
return v.tag.type == T_NIL;
}
+
+int length (struct value v)
+{
+ int i = 0;
+
+ FOREACH (item, v)
+ i++;
+
+ return i;
+}