-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuff
19 lines (16 loc) · 778 Bytes
/
buff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
LOGI: EXP EQL EXP {$$ = $1 == $3 ;} /* for logic operations */
|EXP SUP EXP {printf("%d \n",$1 > $3);}
|EXP INF EXP {printf("%d\n", $1 < $3);}
|EXP SUP_EQ EXP {printf("%d\n", $1 >= $3);}
|EXP INF_EQ EXP {printf("%d \n", $1 == $3);}
|MEM SUP MEM {printf("%d\n", symb[$1] > symb[$3]);}
|MEM INF MEM {printf("%d \n",symb[$1] < symb[$3]);}
|MEM SUP_EQ MEM {printf("%d\n", symb[$1] >= symb[$3]);}
|MEM INF_EQ MEM {printf("%d\n", symb[$1] <= symb[$3]);}
|MEM EQL MEM {printf("%d \n", symb[$1] == symb[$3]);}
MEM: ID {printf("%c=%d\n", $1 + 'A', symb[$1]);} /* Variables */
|ID EQ EXP {symb[$1] = $3;}
|ID ADD ID {symb[$1]=symb[$1] + symb[$3];}
|ID EQ ID SUB ID{symb[$1] = symb[$3] - symb[$5];}
|ID EQ ID POW ID{symb[$1] = pow(symb[$3], symb[$5]);}
|ID EQ ID {symb[$1] = symb[$3];}