term:
'(' term ')' { $$ = $2; }
| term '+' term { $$ = f_new_inst(); $$->code = '+'; $$->a1.p = $1; $$->a2.p = $3; }
+ | term '-' term { $$ = f_new_inst(); $$->code = '-'; $$->a1.p = $1; $$->a2.p = $3; }
+ | term '*' term { $$ = f_new_inst(); $$->code = '*'; $$->a1.p = $1; $$->a2.p = $3; }
+ | term '/' term { $$ = f_new_inst(); $$->code = '/'; $$->a1.p = $1; $$->a2.p = $3; }
| term '=' term { $$ = f_new_inst(); $$->code = P('=','='); $$->a1.p = $1; $$->a2.p = $3; }
| term NEQ term { $$ = f_new_inst(); $$->code = P('!','='); $$->a1.p = $1; $$->a2.p = $3; }
| term '<' term { $$ = f_new_inst(); $$->code = '<'; $$->a1.p = $1; $$->a2.p = $3; }
default: runtime( "Usage of unknown type" );
}
break;
+ case '-':
+ TWOARGS_C;
+ switch (res.type = v1.type) {
+ case T_VOID: runtime( "Can not operate with values of type void" );
+ case T_INT: res.val.i = v1.val.i - v2.val.i; break;
+ default: runtime( "Usage of unknown type" );
+ }
+ break;
+ case '*':
+ TWOARGS_C;
+ switch (res.type = v1.type) {
+ case T_VOID: runtime( "Can not operate with values of type void" );
+ case T_INT: res.val.i = v1.val.i * v2.val.i; break;
+ default: runtime( "Usage of unknown type" );
+ }
+ break;
case '/':
TWOARGS_C;
switch (res.type = v1.type) {
switch(f1->code) {
case ',': /* fall through */
case '+':
+ case '-':
+ case '*':
case '/':
case P('!','='):
case P('=','='):
router id 62.168.0.1;
-define xyzzy = 120+10;
+#define xyzzy = 120+10;
function callme(int arg1; int arg2)
int local1;
{
print "Testing filter language:";
i = four;
- i = 1230 + i;
+ i = 12*100 + 60/2 + i;
i = ( i + 0 );
print " arithmetics: 1234 = ", i;
printn " if statements ";