iris

small scheme interpreter
git clone git://git.2f30.org/iris.git
Log | Files | Refs | LICENSE

commit d59f45a20cf72fd69ddbb3728e4b1a027b86321f
parent 7d842414fb66bebd12d71f174c4c90988cb95275
Author: sin <sin@2f30.org>
Date:   Thu May 15 12:04:51 +0100

Don't segfault on (define a) etc.

Diffstat:
parser.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/parser.c b/parser.c @@ -302,9 +302,11 @@ evaldefine(struct object *o) if (ocar->type == OIdentifier && strcmp(ocar->d.i.s, "define") == 0) { var = cadr(o); - val = eval(caddr(o)); if (var->type != OIdentifier) return error("expected an identifier"); + if (!caddr(o)) + return error("expected sexpression"); + val = eval(caddr(o)); addsym(var->d.i.s, val); return lookupsym("ok"); }