我正在为家庭作业编写解析器,我收到以下警告:
parser.y:145:23: warning: assignment makes pointer from integer without a cast [enabled by default]
$$ = manage_expr_arithop_expr($1, $3, add);
解析器的行是:
$$ = manage_expr_arithop_expr($1, $3, add);
和函数manage_expr_arithop_expr
:
expr* manage_expr_arithop_expr(expr* expr1, expr* expr2, iopcode io_op)
{
expr* expr;
if(expr1 == NULL)
{
printf("Warning: expression1 op expression2, expression1 is NULL \n");
}
else if(expr2 == NULL)
{
printf("Warning: expression1 op expression2, expression2 is NULL \n");
}
if(expr1->type != constnum_e)
{
printf( "Warning: expression1 op expression2, expression1 is not a number");
}
else if(expr2->type != constnum_e)
{
printf("Warning: expression1 op expression2, expression2 is not a number\n");
}
expr = newexpr(arithexpr_e);
expr->sym = new_temporary_variable();
printf("\n\nIn manage arithmetic expression %p \n\n", expr);
emit(io_op, expr, expr1, expr2, 0, yylineno);
return expr;
}
我该怎么办?