Skip to content

Commit

Permalink
scoping works now.
Browse files Browse the repository at this point in the history
  • Loading branch information
johngunderman committed Nov 10, 2009
1 parent a8f0406 commit 71c1ba6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions parser.yacc
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,16 @@ stmt : loc '=' bool ';' {printf("stmt->loc = bool\n");
| WHILE '(' bool ')' stmt {printf("stmt->WHILE ( bool ) stmt\n");}
| DO stmt WHILE '(' bool ')' ';' {printf("stmt->DO stmt WHILE ( bool ) ;\n");}
| BREAK ';' {printf("stmt->BREAK ;\n");}
| block {printf("stmt->block\n");
env = push_env_table(env);
$$ = $1;
env = pop_env_table(env);}
| startscope block {printf("stmt->block\n");
printf("\n\nLeaving Scope\n\n");
env = pop_env_table(env);}
;

startscope : /* EMPTY */ {printf("\n\nEntering New Scope\n\n");
env = push_env_table(env);}
;


loc : loc '[' bool ']' {printf("loc-> loc [ bool ]\n");
/* Looks gross, but all it does is assign the subsize of the current id_type as the value of the list_entry */
((list_entry_t*)$1)->value = ((id_type_t*)((list_entry_t*)$1)->value)->subsize;
Expand Down

0 comments on commit 71c1ba6

Please sign in to comment.