aboutsummaryrefslogtreecommitdiffstats
path: root/c_compiler/src/c_parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'c_compiler/src/c_parser.y')
-rw-r--r--c_compiler/src/c_parser.y7
1 files changed, 4 insertions, 3 deletions
diff --git a/c_compiler/src/c_parser.y b/c_compiler/src/c_parser.y
index 8f70a90..315d227 100644
--- a/c_compiler/src/c_parser.y
+++ b/c_compiler/src/c_parser.y
@@ -177,7 +177,7 @@ IdentifierList: T_IDENTIFIER { $$ = new Declaration(); }
StatementList:
Statement { $$ = $1; }
- | StatementList Statement { $2->linkStatement($$); $$ = $2; }
+| StatementList Statement { $2->linkStatement($$); $$ = $2; printf("# Making statement list\n"); }
;
Statement: CompoundStatement { $$ = $1; }
@@ -205,7 +205,7 @@ SelectionStatement:
ExpressionStatement:
T_SC { $$ = new ExpressionStatement(); }
- | Expression T_SC { $$ = new ExpressionStatement($1); }
+| Expression T_SC { $$ = new ExpressionStatement($1); printf("# Adding Expression statement\n"); }
;
JumpStatement: T_RETURN Expression T_SC { $$ = new JumpStatement($2); }
@@ -214,7 +214,8 @@ JumpStatement: T_RETURN Expression T_SC { $$ = new JumpStatement($2); }
IterationStatement:
T_WHILE T_LRB Expression T_RRB Statement { $$ = new WhileLoop($3, $5); }
| T_DO Statement T_WHILE T_LRB Expression T_RRB T_SC { $$ = $2; }
- | T_FOR T_LRB Expression T_SC Expression T_SC Expression T_RRB Statement { $$ = $9; }
+ | T_FOR T_LRB Expression T_SC Expression T_SC Expression T_RRB Statement
+ { $$ = new ForLoop($3, $5, $7, $9); }
;
// Expressions