Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- line : push identifier ent {pushStack($2);}
- | line push identifier ent {pushStack($3);}
- | pop identifier ent {popStack($2);}
- | line pop identifier ent {popStack($3);}
- | exit_command ent {exit(EXIT_SUCCESS);}
- | show identifier ent {showVal($2);}
- | line show identifier ent {showVal($3);}
- | load identifier identifier ent {loadVal($2,$3);}
- | line load identifier identifier ent {loadVal($3,$4);}
- | line exit_command ent {exit(EXIT_SUCCESS);}
- | line exp ent {$$ = $2; getError($$);}
- | exp ent {$$ = $1; getError($$);}
- | '-' '-' exp ent {printf("ERROR !\n");}
- | line '-' '-' exp ent {printf("ERROR !\n");}
- ;
- exp : term {$$ = $1;}
- | '+' exp {checkError();}
- | '*' exp {checkError();}
- | '/' exp {checkError();}
- | exp and exp {$$ = $1 & $3;}
- | exp or exp {$$ = $1 | $3;}
- | exp '+' exp {$$ = $1 + $3;}
- | exp '-' exp {$$ = $1 - $3;}
- | exp '*' exp {$$ = $1 * $3;}
- | exp '/' exp {$$ = $1 / $3;}
- | exp '\\' exp {$$ = $1 % $3;}
- | exp '^' exp {$$ = pow($1,$3);}
- | '-' exp {$$ = $2*-1;}
- | not exp {$$ = !$2;}
- | '(' exp ')' {$$ = $2;}
- ;
- term : number {$$ = $1;}
- | identifier {$$ = symbolVal($1);}
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement