Hi Jeremy, On Sun, Mar 08, 2020 at 10:40:03AM +0000, Jeremy Sowden wrote: > Just noticed that the production for right shifts differs from the > production for left shifts (src/parser_bison.y, ll. 3020ff.): > > shift_stmt_expr : primary_stmt_expr > | shift_stmt_expr LSHIFT primary_stmt_expr > { > $$ = binop_expr_alloc(&@$, OP_LSHIFT, $1, $3); > } > | shift_stmt_expr RSHIFT primary_rhs_expr > { > $$ = binop_expr_alloc(&@$, OP_RSHIFT, $1, $3); > } > ; > > Is there a reason why the RHS of LSHIFT is primary_stmt_expr, but the > RHS of RSHIFT is primary_rhs_expr? It's likely a leftover. The rhs rule was introduced to reduce chances of hitting shift/reduce conflicts, and to restrict syntax on the rhs.
Attachment:
signature.asc
Description: PGP signature