66 lines
1.0 KiB
C
66 lines
1.0 KiB
C
#define _CRT_SECURE_NO_WARNINGS
|
|
#include <stdio.h>
|
|
#include <windows.h>
|
|
|
|
#include "lang.h"
|
|
#include "os.h"
|
|
#include "memory.h"
|
|
|
|
#include "lex.h"
|
|
#include "parser.h"
|
|
#include "expr.h"
|
|
#include "ast.h"
|
|
|
|
#include "common.c"
|
|
#include "file.c"
|
|
#include "memory.c"
|
|
#include "parser.c"
|
|
#include "os_win32.c"
|
|
|
|
#include "lex.c"
|
|
#include "expr.c"
|
|
#include "ast.c"
|
|
#include "parse_expr.c"
|
|
#include "parse_decl.c"
|
|
#include "print.c"
|
|
#include "codegen_c.c"
|
|
|
|
function void
|
|
full_test(){
|
|
Parser p = {0};
|
|
|
|
#if 1
|
|
parser_init(&p);
|
|
String string = os_read_file(lit("test.cc"));
|
|
parser_lex_stream(&p, string, lit("Parse"));
|
|
Decl *decls = parse(&p);
|
|
assert(decls->list.first);
|
|
{
|
|
gen_begin(&p.scratch, &p);
|
|
gen_forward_decl(decls);
|
|
gen_decl(decls);
|
|
//gen_code(decls);
|
|
gen_end();
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
int
|
|
main(){
|
|
use_write_file("output.cc");
|
|
lex_test();
|
|
parser_test();
|
|
full_test();
|
|
|
|
Arena arena = {};
|
|
Token_Array array = token_array_make(&arena);
|
|
token_array_push(&array, &(Token){});
|
|
close_all_files();
|
|
|
|
|
|
|
|
return 0;
|
|
} |