cherry.c 607 Bytes
Newer Older
1
2
3
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
Chris Müller's avatar
Chris Müller committed
4
#include "cherry.h"
5
6
7
8
9

int main(int argc, char** argv)
{
	printf("Cherry Interpreter 0.1\n\n");

Chris Müller's avatar
Chris Müller committed
10
	org_cherry_initialize(0);
11

Chris Müller's avatar
Chris Müller committed
12
13
14
	struct org_cherry_symbollist* env = org_cherry_symbollist();

	while(1) {
15
		cy_byte_t* line = (cy_byte_t*) readline("> ");
Chris Müller's avatar
Chris Müller committed
16
17
18
19
20
21
22
23
24
25
26
		
        struct org_cherry_context* context = org_cherry_context_repl(line);
		struct org_cherry_value* exp = org_cherry_read(context);

		org_cherry_print(stdout, org_cherry_eval(env, exp));
		printf("\n");
        
        free(line);
	}

	printf("Goodbye\n");
27
28
29

	return EXIT_SUCCESS;
}