29 lines
684 B
C
29 lines
684 B
C
#include <assert.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <ctype.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <stdarg.h>
|
|
#include "base.c"
|
|
#include "meta_gen.c"
|
|
#include "lex.c"
|
|
#include "parser.c"
|
|
#include "emit_asm_x64.c"
|
|
|
|
int main(int argc, char **argv) {
|
|
if (argc == 2) {
|
|
Token_Array tokens = lex_file("expr", argv[1], strlen(argv[1]));
|
|
Parser parser = {tokens.data, tokens.data + tokens.len};
|
|
Ast *ast = parse_expr(&parser, 0);
|
|
FILE *file = fopen("out.s", "w");
|
|
emit_program(file, ast);
|
|
fclose(file);
|
|
} else {
|
|
vec_test();
|
|
lex_test();
|
|
parser_test();
|
|
}
|
|
|
|
} |