blob: 34a847f73b90ee1e0ba397eca1e2dfd53def4dc7 (
plain)
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
|
// Currently the source code depends on the #include order.
// clang-format off
#include "std.h"
#include "common.c"
#include "preprocess.c"
#include "tokenize.c"
#include "ast.c"
#include "parse.c"
#include "codegen.c"
#include "analyze.c"
// clang-format on
int main(int argc, char** argv) {
if (argc == 1) {
fatal_error("usage: ducc <FILE>");
}
FILE* in;
if (strcmp(argv[1], "-") == 0) {
in = stdin;
} else {
in = fopen(argv[1], "rb");
}
char* source = read_all(in);
PpToken* pp_tokens = preprocess(source);
Token* tokens = tokenize(pp_tokens);
Program* prog = parse(tokens);
analyze(prog);
codegen(prog);
}
|