-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver_loop.c
More file actions
executable file
·40 lines (36 loc) · 1.01 KB
/
Copy pathdriver_loop.c
File metadata and controls
executable file
·40 lines (36 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "common.h"
//////////////////////////////////////////////////////////////
//read_sexp is for read_eval_print loop
//////////////////////////////////////////////////////////////
static char ibuffer[1024];
static char *scan = NULL;
static cellpoint read_sexp(void)
{
return read_parse(ibuffer, &scan);
}
//////////////////////////////////////////////////////////////
//read_eval_print loop
//////////////////////////////////////////////////////////////
static char *input_prompt = ";;;CSchemer input: ";
static char *output_prompt = ";;;CSchemer output: ";
void driver_loop(void)
{
initial();
printf("initialed.\n");
while (1){
if (setjmp(jump_buffer) == 0){
printf("\n%s\n", input_prompt);
reg = read_sexp();
//eval the expression with tail_context is a_false
args_push(a_false);
args_push(reg);
reg = eval();
printf("\n%s\n", output_prompt);
write(reg);
newline();
}else {
//error handler, initial some variables
vars_init();
}
}
}