####### Grammar
- $*binode
- Expression -> Expression or BTerm ${
- $0 = new(binode);
- $0->op = Or;
- $0->left = $<1;
- $0->right = $<3;
- }$
+ $*exec
+ Expression -> Expression or BTerm ${ {
+ struct binode *b = new(binode);
+ b->op = Or;
+ b->left = $<1;
+ b->right = $<3;
+ $0 = b;
+ } }$
| BTerm ${ $0 = $<1; }$
- BTerm -> BTerm and BFact ${
- $0 = new(binode);
- $0->op = And;
- $0->left = $<1;
- $0->right = $<3;
- }$
+ BTerm -> BTerm and BFact ${ {
+ struct binode *b = new(binode);
+ b->op = And;
+ b->left = $<1;
+ b->right = $<3;
+ $0 = b;
+ } }$
| BFact ${ $0 = $<1; }$
- BFact -> not BFact ${
- $0 = new(binode);
- $0->op = Not;
- $0->right = $<2;
- }$
+ BFact -> not BFact ${ {
+ struct binode *b = new(binode);
+ b->op = Not;
+ b->right = $<2;
+ $0 = b;
+ } }$
## other BFact
###### print binode cases
NEql,
###### other BFact
- | Expr CMPop Expr ${
- $0 = new(binode);
- $0->op = $2.op;
- $0->left = $<1;
- $0->right = $<3;
- }$
+ | Expr CMPop Expr ${ {
+ struct binode *b = new(binode);
+ b->op = $2.op;
+ b->left = $<1;
+ b->right = $<3;
+ $0 = b;
+ } }$
| Expr ${ $0 = $<1; }$
###### Grammar
###### Grammar
- $*binode
- Expr -> Expr Eop Term ${
- $0 = new(binode);
- $0->op = $2.op;
- $0->left = $<1;
- $0->right = $<3;
- }$
+ $*exec
+ Expr -> Expr Eop Term ${ {
+ struct binode *b = new(binode);
+ b->op = $2.op;
+ b->left = $<1;
+ b->right = $<3;
+ $0 = b;
+ } }$
| Term ${ $0 = $<1; }$
- Term -> Term Top Factor ${
- $0 = new(binode);
- $0->op = $2.op;
- $0->left = $<1;
- $0->right = $<3;
- }$
+ Term -> Term Top Factor ${ {
+ struct binode *b = new(binode);
+ b->op = $2.op;
+ b->left = $<1;
+ b->right = $<3;
+ $0 = b;
+ } }$
| Factor ${ $0 = $<1; }$
- Factor -> ( Expression ) ${
- $0 = new_pos(binode, $1);
- $0->op = Bracket;
- $0->right = $<2;
- }$
- | Uop Factor ${
- $0 = new(binode);
- $0->op = $1.op;
- $0->right = $<2;
- }$
- | Value ${ $0 = (struct binode *)$<1; }$
- | Variable ${ $0 = (struct binode *)$<1; }$
+ Factor -> ( Expression ) ${ {
+ struct binode *b = new_pos(binode, $1);
+ b->op = Bracket;
+ b->right = $<2;
+ $0 = b;
+ } }$
+ | Uop Factor ${ {
+ struct binode *b = new(binode);
+ b->op = $1.op;
+ b->right = $<2;
+ $0 = b;
+ } }$
+ | Value ${ $0 = $<1; }$
+ | Variable ${ $0 = $<1; }$
$eop
Eop -> + ${ $0.op = Plus; }$