Slide 84
Slide 84 text
|---| @$ (1.0-1.5)
1 + 2
^ ^ ^
| | +- @3 (1.4-1.5)
| +--- @2 (1.2-1.3)
+----- @1 (1.0-1.1)
arg | arg '+' arg
{
$$ = call_bin_op(p, $1, '+', $3, &@2, &@$);
}
static NODE *
call_bin_op(struct parser_params *p, NODE *recv, ID id, NODE *arg1,
const YYLTYPE *op_loc, const YYLTYPE *loc)
{
...
expr = NEW_OPCALL(recv, id, NEW_LIST(arg1, &arg1->nd_loc), loc);
...
}
arg | arg '+' arg
{
$$ = call_bin_op(p, $1, '+', $3, &@2, &@$);
}
static NODE *
call_bin_op(struct parser_params *p, NODE *recv, ID id, NODE *arg1,
const YYLTYPE *op_loc, const YYLTYPE *loc)
{
...
expr = NEW_OPCALL(recv, id, NEW_LIST(arg1, &arg1->nd_loc), loc);
...
}
1 2