+NEW_ASSIGNMENT : "var" T_IDENTIFIER MAYBETYPE '=' EXPRESSION {
+ int i = newvariable(0,0,$2,$3);
+ $$ = $5;
+ $$ = abc_setlocal($$, i);
+}
+ASSIGNMENT : T_IDENTIFIER '=' EXPRESSION {
+ int i = array_find(state->vars, $1->text);
+ if(i<0) {
+ syntaxerror("Unknown variable '%s'", $1->text);
+ }
+ $$ = $3;
+ $$ = abc_setlocal($$, i);
+}
+SOME_ASSIGNMENT : ASSIGNMENT | NEW_ASSIGNMENT
+
+FOR : "for" '(' SOME_ASSIGNMENT ';' EXPRESSION ';' EXPRESSION ')' '{' MAYBECODE '}' {
+ $$ = $3;
+ code_t*loopstart = $$ = abc_label($$);
+ $$ = code_append($$, $5);
+ code_t*myif = $$ = abc_iffalse($$, 0);
+ $$ = code_append($$, $10);
+ $$ = code_append($$, $7);$$=abc_pop($$);
+ $$ = abc_jump($$, loopstart);
+ $$ = abc_label($$);
+ myif->branch = $$;
+}
+MAYBEELSE: %prec prec_none {$$ = code_new();}
+MAYBEELSE: "else" CODEBLOCK {$$=$2;}
+MAYBEELSE: ';' "else" CODEBLOCK {$$=$3;}
+
+IF : "if" '(' EXPRESSION ')' CODEBLOCK MAYBEELSE {
+ $$=$3;
+ code_t*myjmp,*myif = $$ = abc_iffalse($$, 0);
+ $$ = code_append($$, $5);
+ if($6) {
+ myjmp = $$ = abc_jump($$, 0);
+ }
+ myif->branch = $$ = abc_label($$);
+ if($6) {
+ $$ = code_append($$, $6);
+ myjmp->branch = $$ = abc_label($$);
+ }
+}
+
+USE : "use" KW_NAMESPACE T_IDENTIFIER
+
+