-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtestREPL.mc
53 lines (46 loc) · 1.05 KB
/
testREPL.mc
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
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <setjmp.h>
#include <time.h>
#include <dlfcn.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/file.h>
#include <fcntl.h>
#include <string.h>
#include "mc.h"
voidptr symbol_value[SYMBOL_DIM];
expptr load(expptr forms);
void MC_doit(expptr e){
fputc('\n',stdout);
pprint(load(append(preamble,append(init_forms,cons(e,nil)))),stdout,0);
}
void read_eval_print(){
dolist(e,file_expressions("testREPLdata.mc")){
if(e == nil)continue;
fprintf(stdout, "\nMC>");
pprint(e,stdout,0);
preamble = nil;
init_forms = nil;
expptr e2 = macroexpand(e);
ucase{e2;
{$s;}:{MC_doit(e2);}
{{$s}}:{MC_doit(e2);}
{$type $f($args){$body}}:{MC_doit(e2);}
{$e}:{MC_doit(`{return $e2;});}}}
}
int main(int argc, char **argv){
mcA_init();
mcB_init();
mcC_init();
mcD_init();
mcE_init1();
mcE_init2();
rep_column = -3;
catch_error(insert_base())
if(error_flg[0] != 0)return error_flg[0];
read_eval_print();
return 0;
}