Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VarsAndStatements: %empty {$$=insereNo(NULL,"NULL");}
- | VarsAndStatements SEMICOLON {$$=$1;}
- | VarsAndStatements VarDeclaration SEMICOLON {$$=$1;insereNoIrmao($1,$2);}
- | VarsAndStatements Statement SEMICOLON {$$=$1; insereNoIrmao($1,$2);}
- ;
- Statement: ID ASSIGN Expr {$$=insereNo(NULL, "Assign"); $$->filho = insereNo($1, "Id"); insereNoIrmao($$->filho, $3); }
- | LBRACE StatementAux RBRACE {$$=$2;}
- | IF Expr LBRACE StatementAux RBRACE {$$=insereNo(NULL, "If"); $$->filho=$3;}
- | IF Expr LBRACE StatementAux RBRACE ELSE LBRACE StatementAux RBRACE {$$=insereNo(NULL, "If"); $$->filho=$3;}
- | FOR LBRACE StatementAux RBRACE {$$=insereNo(NULL, "For"); $$->filho=$3;}
- | FOR Expr LBRACE StatementAux RBRACE {$$=insereNo(NULL, "For"); $$->filho = $2;}
- | RETURN {$$=insereNo(NULL, "Return");}
- | RETURN Expr {$$=insereNo(NULL, "Return"); $$->filho = $2;}
- | FuncInvocation {$$=insereNo(NULL, "Call"); $$->filho=$1;}
- | ParseArgs {$$=$1}
- | PRINT LPAR Expr RPAR {$$=insereNo(NULL, "Print"); $$->filho = $3;}
- | PRINT LPAR STRLIT RPAR {$$=insereNo(NULL, "Print"); $$->filho=insereNo($3, "StrLit");}
- | error {$$=insereNo(NULL, "NULL");}
- ;
- StatementAux: %empty {$$=insereNo(NULL, "NULL");}
- | Statement SEMICOLON StatementAux {$$=$1; /*insereNoIrmao($$, $3);*/}
- ;
- ParseArgs: ID COMMA BLANKID ASSIGN PARSEINT LPAR CMDARGS LSQ Expr RSQ RPAR {/*$$=insereNo(NULL, "Id");*/}
- | ID COMMA BLANKID ASSIGN PARSEINT LPAR error RPAR {$$=insereNo(NULL, "NULL");}
- ;
- FuncInvocation:
- ID LPAR RPAR {$$=insereNo(NULL, "Id");}
- | ID LPAR Expr FuncInvocationAux RPAR {$$=insereNo(NULL, "Id"); insereNoIrmao($$,$3); insereNoIrmao($3, $4);}
- | ID LPAR error RPAR {$$=insereNo(NULL, "NULL");}
- ;
- FuncInvocationAux: %empty {$$=insereNo(NULL, "NULL");}
- | COMMA Expr FuncInvocationAux {$$=$2; insereNoIrmao($$, $3);}
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement