aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/main.c b/main.c
index 463d290..d82d911 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <getopt.h>
+#include <stdlib.h>
#include "cibic.tab.h"
#include "ast.h"
@@ -12,21 +13,20 @@ int yywrap() {
}
int yyerror(char *s) {
+ fprintf(stderr, "%s\n", s);
}
void print_ast() {
- yyparse();
if (fname)
- printf("AST for file: \"%s\"\n", fname);
+ fprintf(stderr, "AST for file: \"%s\"\n", fname);
else
- printf("AST for stdin\n");
-
+ fprintf(stderr, "AST for stdin\n");
+ yyparse();
if (ast_root)
{
cnode_debug_print(ast_root, 1);
}
- else
- fprintf(stdout, "Syntax Error\n");
+ else exit(1);
}
void print_help() {