#include #include "ast.h" #include "lexer.h" extern struct Node* program_root; int yyparse(void); static int parse_program(void) { int status = yyparse(); if (status != 0 || lexer_failed()) status = 1; node_free(program_root); program_root = NULL; return status; } int main(int argc, char** argv) { if (argc != 2) { (void)fprintf(stderr, "usage: sfinae \n"); return 2; } yyin = fopen(argv[1], "r"); if (yyin == NULL) { (void)fprintf(stderr, "cannot open %s\n", argv[1]); return 1; } int status = parse_program(); (void)fclose(yyin); return status; }