X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=main.c;h=eb0c479ad8a1ba318bff2bc1087d3fd9936e82b9;hb=97f33b63c421063c4cbc869c60076b9132667835;hp=799f3640b43ecfe6d2337688357fcddfaa5e5000;hpb=9e29e9c33f6511c4583e5b8ed83194d433e82c45;p=cparser diff --git a/main.c b/main.c index 799f364..eb0c479 100644 --- a/main.c +++ b/main.c @@ -7,6 +7,7 @@ #include "lexer_t.h" #include "token_t.h" +#include "type_hash.h" #include "parser.h" #if 0 @@ -38,8 +39,6 @@ void get_output_name(char *buf, size_t buflen, const char *inputname, static void compile(const char *fname) { - token_t token; - FILE *in = fopen(fname, "r"); if(in == NULL) { fprintf(stderr, "Couldn't open '%s': %s\n", fname, strerror(errno)); @@ -48,11 +47,16 @@ void compile(const char *fname) lexer_open_stream(in, fname); +#if 0 + token_t token; do { lexer_next_token(&token); print_token(stdout, &token); puts(""); } while(token.type != T_EOF); +#else + parse(); +#endif fclose(in); } @@ -62,6 +66,9 @@ int main(int argc, char **argv) init_symbol_table(); init_tokens(); init_lexer(); + init_types(); + init_typehash(); + init_ast(); init_parser(); for(int i = 1; i < argc; ++i) { @@ -69,6 +76,9 @@ int main(int argc, char **argv) } exit_parser(); + exit_ast(); + exit_typehash(); + exit_types(); exit_lexer(); exit_tokens(); exit_symbol_table();