-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
74 lines (69 loc) · 1.45 KB
/
main.c
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "basictypes.h"
#include "eval.h"
#include "fun.h"
#include "global.h"
#include "include.h"
#include "jit.h"
#include "list.h"
#include "quote.h"
#include "structs.h"
#include "type.h"
#include "var.h"
#include <alloca.h>
#include <string.h>
int main(int argc, char **argv) {
int i;
int read_filename;
struct val **files;
dump_modules = 0;
dump_lists = 0;
read_filename = 0;
enable_precompilation = 0;
files = alloca(argc * sizeof(char *));
for (i = 1; i < argc; ++i) {
files[i] = NULL;
if (strcmp(argv[i], "--dump-modules") == 0) {
dump_modules = 1;
} else if (strcmp(argv[i], "--dump-lists") == 0) {
dump_lists = 1;
} else if (strcmp(argv[i], "--enable-precompilation") == 0) {
enable_precompilation = 1;
} else if (strcmp(argv[i], "-") == 0) {
files[i] = read_stdin();
} else {
files[i] = read_file(argv[i]);
}
}
init_alloc();
init_jit();
init_types();
init_fun();
init_basictypes();
init_global();
init_var();
init_quote();
init_include();
init_eval();
init_structs();
for (i = 1; i < argc; ++i) {
if (files[i]) {
lower_include_list(argv[i], files[i]);
read_filename = 1;
}
}
if (!read_filename) {
compiler_error_internal("no filename specified");
}
end_structs();
end_eval();
end_include();
end_quote();
end_var();
end_global();
end_basictypes();
end_fun();
end_types();
end_jit();
end_alloc();
return 0;
}