+/* Some kind of subscripted expression */
+subscripted: star '{' expr ';' '}' /* *main::{something} */
+ /* In this and all the hash accessors, ';' is
+ * provided by the tokeniser */
+ { $$ = newBINOP(OP_GELEM, 0, $1, scalar($3));
+ PL_expect = XOPERATOR; }
+ | scalar '[' expr ']' /* $array[$element] */
+ { $$ = newBINOP(OP_AELEM, 0, oopsAV($1), scalar($3)); }
+ | term ARROW '[' expr ']' /* somearef->[$element] */
+ { $$ = newBINOP(OP_AELEM, 0,
+ ref(newAVREF($1),OP_RV2AV),
+ scalar($4));}
+ | subscripted '[' expr ']' /* $foo->[$bar]->[$baz] */
+ { $$ = newBINOP(OP_AELEM, 0,
+ ref(newAVREF($1),OP_RV2AV),
+ scalar($3));}
+ | scalar '{' expr ';' '}' /* $foo->{bar();} */
+ { $$ = newBINOP(OP_HELEM, 0, oopsHV($1), jmaybe($3));
+ PL_expect = XOPERATOR; }
+ | term ARROW '{' expr ';' '}' /* somehref->{bar();} */
+ { $$ = newBINOP(OP_HELEM, 0,
+ ref(newHVREF($1),OP_RV2HV),
+ jmaybe($4));
+ PL_expect = XOPERATOR; }
+ | subscripted '{' expr ';' '}' /* $foo->[bar]->{baz;} */
+ { $$ = newBINOP(OP_HELEM, 0,
+ ref(newHVREF($1),OP_RV2HV),
+ jmaybe($3));
+ PL_expect = XOPERATOR; }
+ | term ARROW '(' ')' /* $subref->() */
+ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ newCVREF(0, scalar($1))); }
+ | term ARROW '(' expr ')' /* $subref->(@args) */
+ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST, $4,
+ newCVREF(0, scalar($1)))); }
+
+ | subscripted '(' expr ')' /* $foo->{bar}->(@args) */
+ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST, $3,
+ newCVREF(0, scalar($1)))); }
+ | subscripted '(' ')' /* $foo->{bar}->() */
+ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ newCVREF(0, scalar($1))); }
+ | '(' expr ')' '[' expr ']' /* list slice */
+ { $$ = newSLICEOP(0, $5, $2); }
+ | '(' ')' '[' expr ']' /* empty list slice! */
+ { $$ = newSLICEOP(0, $4, Nullop); }
+ ;
+
+/* Binary operators between terms */
+termbinop : term ASSIGNOP term /* $x = $y */