-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
61 lines (52 loc) · 1.05 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
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <math.h>
#include <errno.h>
#include <limits.h>
#include "common.c"
#include "os.c"
#include "error.c"
#include "lex.c"
#include "ast.h"
#include "ast.c"
#include "print.c"
#include "parse.c"
#include "type.c"
#include "resolve.c"
#include "codegen.c"
#include "ion.c"
void run_tests(void) {
init_compiler();
read_dir_test();
da_test();
map_test();
str_intern_test();
lex_test();
parse_test();
type_intern_test();
codegen_test();
}
int main(int argc, char **argv) {
(void)argc; (void)argv;
// run_tests();
if (argc < 2) {
printf("usage: %s <ion-package> [outfile]\n", argv[0]);
return 1;
}
char *package_name = argv[1];
char *out_name = argc >= 3 ? argv[2] : NULL;
if (!compile_package(package_name, out_name)) {
fprintf(stderr, "Failed to compile package %s\n", package_name);
return 1;
}
return 0;
}