-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.c
More file actions
33 lines (28 loc) · 685 Bytes
/
main.c
File metadata and controls
33 lines (28 loc) · 685 Bytes
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
#include "scanner.h"
#include "debug.h"
#include "ast.h"
#include "decl.h"
#include "codegen.h"
#include "symtab.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
init_debugging();
if (argc < 2)
{
debug_print(SEV_ERROR, "Usage: %s <inputfile>", argv[0]);
exit(1);
}
symtab_init_global_symtab();
Scanner_t *scanner = scanner_init(argv[1]);
ASTNode_t *root = decl_declarations(scanner);
if (root == NULL)
{
debug_print(SEV_ERROR, "Couldn't create root node");
}
ast_print(root);
CodeGenerator_t *generator = codegen_init("out.s");
codegen_start(generator, root);
return 0;
}