aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2014-04-04 01:07:15 +0800
committerTeddy <ted.sybil@gmail.com>2014-04-04 01:07:15 +0800
commita52fc0e7c5d05c7a4b18d8520826e448576826f9 (patch)
treee074fa63de537a34cdac5a3a78a5ae2788dad2ba /main.c
parentef1c46b1eef2b22100d9eca9c4d0e6ffab7c7eab (diff)
...
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/main.c b/main.c
index af16c46..17a10ad 100644
--- a/main.c
+++ b/main.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include "cibic.tab.h"
#include "ast.h"
+#include "semantics.h"
extern char linebuff[];
extern char *lptr;
@@ -41,6 +42,11 @@ void print_ast() {
else exit(1);
}
+void print_sem() {
+ yyparse();
+ semantics_check(ast_root);
+}
+
void print_help() {
fprintf(stderr,
"CBIC: C Implemented Bare and Ingenuous Compiler\n\n"
@@ -62,8 +68,9 @@ static struct option lopts[] = {
enum {
PRINT_AST,
- PRINT_HELP
-} mode = PRINT_HELP;
+ PRINT_HELP,
+ PRINT_SEM
+} mode = PRINT_SEM;
int main(int argc, char **argv) {
int option_index = 0;
@@ -103,6 +110,7 @@ int main(int argc, char **argv) {
{
case PRINT_AST: print_ast(); break;
case PRINT_HELP: print_help(); break;
+ default: print_sem();
}
return 0;
}