This commit is contained in:
Krzosa Karol
2022-04-30 12:28:34 +02:00
parent a5a3acf3ef
commit 3a9b748fed
15 changed files with 296 additions and 746 deletions

22
main.c
View File

@@ -5,11 +5,11 @@
#include "lang.h"
#include "os.h"
#include "memory.h"
#include "lex.h"
#include "ast.h"
#include "parser.h"
#include "type.h"
#include "expr.h"
#include "decl.h"
global FILE *global_output_file;
#define lex_print(...) fprintf(global_output_file, __VA_ARGS__)
@@ -19,10 +19,10 @@ global FILE *global_output_file;
#include "memory.c"
#include "parser.c"
#include "os_win32.c"
#include "lex.c"
#include "expr.c"
#include "decl.c"
#include "type.c"
#include "ast.c"
#include "parse_expr.c"
#include "parse_decl.c"
#include "print.c"
@@ -98,21 +98,15 @@ parser_test(){
expr_print(expr);
lex_print("\n");
}
type_test(&p);
lex_new_line();
String decls[] = {
lit("enum Thing{ Thing_1, Thing_2 = 2}"),
lit("global S64 *variable[10] = 10"),
lit("global S64 (*variable)(S64 thing) = 10"),
lit("struct Thing{ S64 a; U64 *b; union A{ S64 thing; }; }"),
lit("enum Thing{ Thing_1 = 10, Thing_2 = 20<<1 };"),
};
for(S64 i = 0; i < buff_cap(decls); i++){
parser_lex_stream(&p, decls[i], lit("File"));
Decl *decl = parse_decl_global(&p);
assert(decl);
decl_print(decl);
lex_new_line();
AST_Node *node = parse(&p);
assert(node);
}
}