iris

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

repl.c (454B)


      1 /* See LICENSE file for copyright and license details. */
      2 #include <stdbool.h>
      3 #include <stdio.h>
      4 #include <unistd.h>
      5 #include "parser.h"
      6 
      7 int
      8 main(void)
      9 {
     10 	int interactive = isatty(0);
     11 
     12 	init();
     13 	if (interactive)
     14 		puts("Welcome to iris - use ^C to quit");
     15 	do {
     16 		if (interactive) {
     17 			printf("> ");
     18 			fflush(stdout);
     19 		}
     20 		print(eval(sexpression(stdin)));
     21 		putchar('\n');
     22 		fflush(stdout);
     23 	} while (!feof(stdin));
     24 	/* not reachable */
     25 	return 0;
     26 }