iris

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

commit cfddb48f967035774e65243ce9fe52c5fc9a26f2
parent 30bcc78313a2fd2e676ad14f5a62bd6450ec117f
Author: sin <sin@2f30.org>
Date:   Wed May 14 16:03:28 +0100

Make it look like an repl prompt

Diffstat:
parser.c | 12++++++------
repl.c | 3+++
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/parser.c b/parser.c @@ -153,22 +153,22 @@ print(struct object *o) return; switch (o->type) { case OError: - printf("%s\n", o->d.err.s); + printf("%s", o->d.err.s); break; case OEof: - printf("%s\n", o->d.eof.s); + printf("%s", o->d.eof.s); break; case OBoolean: - printf("#%c\n", o->d.b.v == false ? 'f' : 't'); + printf("#%c", o->d.b.v == false ? 'f' : 't'); break; case ONumber: - printf("%ld\n", o->d.n.v); + printf("%ld", o->d.n.v); break; case OCharacter: - printf("#\\%c\n", o->d.c.v); + printf("#\\%c", o->d.c.v); break; case OString: - printf("%s\n", o->d.s.s); + printf("%s", o->d.s.s); break; } } diff --git a/repl.c b/repl.c @@ -7,7 +7,10 @@ int main(void) { do { + printf("> "); print(eval(sexpression(stdin))); + putchar('\n'); + fflush(stdout); } while (1); /* not reachable */ return 0;