3 * Copyright (c) 1991-2002, 2003, 2004 Larry Wall
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
11 * 'I see,' laughed Strider. 'I look foul and feel fair. Is that it?
12 * All that is gold does not glitter, not all those who wander are lost.'
15 /* This file holds the grammar for the Perl language. If edited, you need
16 * to run regen_perly.pl, which re-creates the files perly.h, perly.tab
17 * and perly.act which are derived from this.
19 * The main job of of this grammar is to call the various newFOO()
20 * functions in op.c to build a syntax tree of OP structs.
21 * It relies on the lexer in toke.c to do the tokenizing.
24 /* Make the parser re-entrant. */
42 %token <opval> WORD METHOD FUNCMETH THING PMFUNC PRIVATEREF
43 %token <opval> FUNC0SUB UNIOPSUB LSTOPSUB
45 %token <ival> FORMAT SUB ANONSUB PACKAGE USE
46 %token <ival> WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE FOR
47 %token <ival> GIVEN WHEN DEFAULT
48 %token <ival> LOOPEX DOTDOT
49 %token <ival> FUNC0 FUNC1 FUNC UNIOP LSTOP
50 %token <ival> RELOP EQOP MULOP ADDOP
51 %token <ival> DOLSHARP DO HASHBRACK NOAMP
52 %token <ival> LOCAL MY MYSUB REQUIRE
55 %type <ival> prog decl format startsub startanonsub startformsub mintro
56 %type <ival> progstart remember mremember '&' savescope mydefsv
57 %type <opval> block mblock lineseq line loop cond else
58 %type <opval> expr term subscripted scalar ary hsh arylen star amper sideff
59 %type <opval> argexpr nexpr texpr iexpr mexpr mnexpr miexpr
60 %type <opval> listexpr listexprcom indirob listop method
61 %type <opval> formname subname proto subbody cont my_scalar
62 %type <opval> subattrlist myattrlist mysubrout myattrterm myterm
63 %type <opval> termbinop termunop anonymous termdo
64 %type <opval> switch case
70 %left <ival> OROP DOROP
73 %nonassoc LSTOP LSTOPSUB
75 %right <ival> ASSIGNOP
84 %nonassoc UNIOP UNIOPSUB
90 %right '!' '~' UMINUS REFGEN
92 %nonassoc PREINC PREDEC POSTINC POSTDEC
102 /* The whole program */
104 /*CONTINUED*/ lineseq
105 { $$ = $1; newPROG(block_end($1,$2)); }
108 /* An ordinary block */
109 block : '{' remember lineseq '}'
110 { if (PL_copline > (line_t)$1)
111 PL_copline = (line_t)$1;
112 $$ = block_end($2, $3); }
115 remember: /* NULL */ /* start a full lexical scope */
116 { $$ = block_start(TRUE); }
119 mydefsv: /* NULL */ /* lexicalize $_ */
120 { $$ = (I32) allocmy("$_"); }
125 PL_expect = XSTATE; $$ = block_start(TRUE);
130 mblock : '{' mremember lineseq '}'
131 { if (PL_copline > (line_t)$1)
132 PL_copline = (line_t)$1;
133 $$ = block_end($2, $3); }
136 mremember: /* NULL */ /* start a partial lexical scope */
137 { $$ = block_start(FALSE); }
140 savescope: /* NULL */ /* remember stack pos in case of error */
141 { $$ = PL_savestack_ix; }
143 /* A collection of "lines" in the program */
148 | lineseq savescope line
150 $$ = append_list(OP_LINESEQ,
151 (LISTOP*)$1, (LISTOP*)$3);
152 PL_pad_reset_pending = TRUE;
153 if ($1 && $3) PL_hints |= HINT_BLOCK_SCOPE; }
156 /* A "line" in the program */
158 { $$ = newSTATEOP(0, $1, $2); }
159 | loop /* loops add their own labels */
160 | switch /* ... and so do switches */
163 { $$ = newSTATEOP(0, $1, $2); }
165 { if ($1 != Nullch) {
166 $$ = newSTATEOP(0, $1, newOP(OP_NULL, 0));
172 PL_expect = XSTATE; }
174 { $$ = newSTATEOP(0, $1, $2);
175 PL_expect = XSTATE; }
178 /* An expression which may have a side-effect */
184 { $$ = newLOGOP(OP_AND, 0, $3, $1); }
186 { $$ = newLOGOP(OP_OR, 0, $3, $1); }
188 { $$ = newLOOPOP(OPf_PARENS, 1, scalar($3), $1); }
190 { $$ = newLOOPOP(OPf_PARENS, 1, $3, $1);}
192 { $$ = newFOROP(0, Nullch, (line_t)$2,
193 Nullop, $3, $1, Nullop); }
196 /* else and elsif blocks */
200 { ($2)->op_flags |= OPf_PARENS; $$ = scope($2); }
201 | ELSIF '(' mexpr ')' mblock else
202 { PL_copline = (line_t)$1;
203 $$ = newCONDOP(0, $3, scope($5), $6);
204 PL_hints |= HINT_BLOCK_SCOPE; }
207 /* Real conditional expressions */
208 cond : IF '(' remember mexpr ')' mblock else
209 { PL_copline = (line_t)$1;
211 newCONDOP(0, $4, scope($6), $7)); }
212 | UNLESS '(' remember miexpr ')' mblock else
213 { PL_copline = (line_t)$1;
215 newCONDOP(0, $4, scope($6), $7)); }
218 /* Cases for a switch statement */
219 case : WHEN '(' remember mexpr ')' mblock
221 newWHENOP($4, scope($6))); }
223 { $$ = newWHENOP(0, scope($2)); }
226 /* Continue blocks */
233 /* Loops: while, until, for, and a bare block */
234 loop : label WHILE '(' remember texpr ')' mintro mblock cont
235 { PL_copline = (line_t)$2;
238 newWHILEOP(0, 1, (LOOP*)Nullop,
239 $2, $5, $8, $9, $7))); }
240 | label UNTIL '(' remember iexpr ')' mintro mblock cont
241 { PL_copline = (line_t)$2;
244 newWHILEOP(0, 1, (LOOP*)Nullop,
245 $2, $5, $8, $9, $7))); }
246 | label FOR MY remember my_scalar '(' mexpr ')' mblock cont
248 newFOROP(0, $1, (line_t)$2, $5, $7, $9, $10)); }
249 | label FOR scalar '(' remember mexpr ')' mblock cont
251 newFOROP(0, $1, (line_t)$2, mod($3, OP_ENTERLOOP),
253 | label FOR '(' remember mexpr ')' mblock cont
255 newFOROP(0, $1, (line_t)$2, Nullop, $5, $7, $8)); }
256 | label FOR '(' remember mnexpr ';' texpr ';' mintro mnexpr ')'
258 /* basically fake up an initialize-while lineseq */
260 PL_copline = (line_t)$2;
261 forop = newSTATEOP(0, $1,
262 newWHILEOP(0, 1, (LOOP*)Nullop,
266 forop = append_elem(OP_LINESEQ,
267 newSTATEOP(0, ($1?savepv($1):Nullch),
272 $$ = block_end($4, forop); }
273 | label block cont /* a block is a loop that happens once */
274 { $$ = newSTATEOP(0, $1,
275 newWHILEOP(0, 1, (LOOP*)Nullop,
276 NOLINE, Nullop, $2, $3, 0)); }
280 switch : label GIVEN '(' remember mydefsv mexpr ')' mblock
281 { PL_copline = (line_t) $2;
284 newGIVENOP($6, scope($8),
285 (PADOFFSET) $5) )); }
288 /* determine whether there are any new my declarations */
290 { $$ = (PL_min_intro_pending &&
291 PL_max_intro_pending >= PL_min_intro_pending);
294 /* Normal expression */
300 /* Boolean expression */
301 texpr : /* NULL means true */
302 { (void)scan_num("1", &yylval); $$ = yylval.opval; }
306 /* Inverted boolean expression */
308 { $$ = invert(scalar($1)); }
311 /* Expression with its own lexical scope */
313 { $$ = $1; intro_my(); }
317 { $$ = $1; intro_my(); }
321 { $$ = $1; intro_my(); }
324 /* Optional "MAIN:"-style loop labels */
330 /* Some kind of declaration - does not take part in the parse tree */
343 format : FORMAT startformsub formname block
344 { newFORM($2, $3, $4); }
347 formname: WORD { $$ = $1; }
348 | /* NULL */ { $$ = Nullop; }
351 /* Unimplemented "my sub foo { }" */
352 mysubrout: MYSUB startsub subname proto subattrlist subbody
353 { newMYSUB($2, $3, $4, $5, $6); }
356 /* Subroutine definition */
357 subrout : SUB startsub subname proto subattrlist subbody
358 { newATTRSUB($2, $3, $4, $5, $6); }
361 startsub: /* NULL */ /* start a regular subroutine scope */
362 { $$ = start_subparse(FALSE, 0); }
365 startanonsub: /* NULL */ /* start an anonymous subroutine scope */
366 { $$ = start_subparse(FALSE, CVf_ANON); }
369 startformsub: /* NULL */ /* start a format subroutine scope */
370 { $$ = start_subparse(TRUE, 0); }
373 /* Name of a subroutine - must be a bareword, could be special */
374 subname : WORD { const char *const name = SvPV_nolen_const(((SVOP*)$1)->op_sv);
375 if (strEQ(name, "BEGIN") || strEQ(name, "END")
376 || strEQ(name, "INIT") || strEQ(name, "CHECK"))
377 CvSPECIAL_on(PL_compcv);
381 /* Subroutine prototype */
387 /* Optional list of subroutine attributes */
388 subattrlist: /* NULL */
396 /* List of attributes for a "my" variable declaration */
397 myattrlist: COLONATTR THING
403 /* Subroutine body - either null or a block */
404 subbody : block { $$ = $1; }
405 | ';' { $$ = Nullop; PL_expect = XSTATE; }
408 package : PACKAGE WORD ';'
413 { CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ }
414 WORD WORD listexpr ';'
415 { utilize($1, $2, $4, $5, $6); }
418 /* Ordinary expressions; logical combinations */
419 expr : expr ANDOP expr
420 { $$ = newLOGOP(OP_AND, 0, $1, $3); }
422 { $$ = newLOGOP($2, 0, $1, $3); }
424 { $$ = newLOGOP(OP_DOR, 0, $1, $3); }
425 | argexpr %prec PREC_LOW
428 /* Expressions are a list of terms joined by commas */
429 argexpr : argexpr ','
432 { $$ = append_elem(OP_LIST, $1, $3); }
433 | term %prec PREC_LOW
437 listop : LSTOP indirob argexpr /* map {...} @args or print $fh @args */
438 { $$ = convert($1, OPf_STACKED,
439 prepend_elem(OP_LIST, newGVREF($1,$2), $3) ); }
440 | FUNC '(' indirob expr ')' /* print ($fh @args */
441 { $$ = convert($1, OPf_STACKED,
442 prepend_elem(OP_LIST, newGVREF($1,$3), $4) ); }
443 | term ARROW method '(' listexprcom ')' /* $foo->bar(list) */
444 { $$ = convert(OP_ENTERSUB, OPf_STACKED,
446 prepend_elem(OP_LIST, scalar($1), $5),
447 newUNOP(OP_METHOD, 0, $3))); }
448 | term ARROW method /* $foo->bar */
449 { $$ = convert(OP_ENTERSUB, OPf_STACKED,
450 append_elem(OP_LIST, scalar($1),
451 newUNOP(OP_METHOD, 0, $3))); }
452 | METHOD indirob listexpr /* new Class @args */
453 { $$ = convert(OP_ENTERSUB, OPf_STACKED,
455 prepend_elem(OP_LIST, $2, $3),
456 newUNOP(OP_METHOD, 0, $1))); }
457 | FUNCMETH indirob '(' listexprcom ')' /* method $object (@args) */
458 { $$ = convert(OP_ENTERSUB, OPf_STACKED,
460 prepend_elem(OP_LIST, $2, $4),
461 newUNOP(OP_METHOD, 0, $1))); }
462 | LSTOP listexpr /* print @args */
463 { $$ = convert($1, 0, $2); }
464 | FUNC '(' listexprcom ')' /* print (@args) */
465 { $$ = convert($1, 0, $3); }
466 | LSTOPSUB startanonsub block /* sub f(&@); f { foo } ... */
467 { $3 = newANONATTRSUB($2, 0, Nullop, $3); }
468 listexpr %prec LSTOP /* ... @bar */
469 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
471 prepend_elem(OP_LIST, $3, $5), $1)); }
474 /* Names of methods. May use $object->$methodname */
479 /* Some kind of subscripted expression */
480 subscripted: star '{' expr ';' '}' /* *main::{something} */
481 /* In this and all the hash accessors, ';' is
482 * provided by the tokeniser */
483 { $$ = newBINOP(OP_GELEM, 0, $1, scalar($3));
484 PL_expect = XOPERATOR; }
485 | scalar '[' expr ']' /* $array[$element] */
486 { $$ = newBINOP(OP_AELEM, 0, oopsAV($1), scalar($3)); }
487 | term ARROW '[' expr ']' /* somearef->[$element] */
488 { $$ = newBINOP(OP_AELEM, 0,
489 ref(newAVREF($1),OP_RV2AV),
491 | subscripted '[' expr ']' /* $foo->[$bar]->[$baz] */
492 { $$ = newBINOP(OP_AELEM, 0,
493 ref(newAVREF($1),OP_RV2AV),
495 | scalar '{' expr ';' '}' /* $foo->{bar();} */
496 { $$ = newBINOP(OP_HELEM, 0, oopsHV($1), jmaybe($3));
497 PL_expect = XOPERATOR; }
498 | term ARROW '{' expr ';' '}' /* somehref->{bar();} */
499 { $$ = newBINOP(OP_HELEM, 0,
500 ref(newHVREF($1),OP_RV2HV),
502 PL_expect = XOPERATOR; }
503 | subscripted '{' expr ';' '}' /* $foo->[bar]->{baz;} */
504 { $$ = newBINOP(OP_HELEM, 0,
505 ref(newHVREF($1),OP_RV2HV),
507 PL_expect = XOPERATOR; }
508 | term ARROW '(' ')' /* $subref->() */
509 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
510 newCVREF(0, scalar($1))); }
511 | term ARROW '(' expr ')' /* $subref->(@args) */
512 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
513 append_elem(OP_LIST, $4,
514 newCVREF(0, scalar($1)))); }
516 | subscripted '(' expr ')' /* $foo->{bar}->(@args) */
517 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
518 append_elem(OP_LIST, $3,
519 newCVREF(0, scalar($1)))); }
520 | subscripted '(' ')' /* $foo->{bar}->() */
521 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
522 newCVREF(0, scalar($1))); }
523 | '(' expr ')' '[' expr ']' /* list slice */
524 { $$ = newSLICEOP(0, $5, $2); }
525 | '(' ')' '[' expr ']' /* empty list slice! */
526 { $$ = newSLICEOP(0, $4, Nullop); }
529 /* Binary operators between terms */
530 termbinop : term ASSIGNOP term /* $x = $y */
531 { $$ = newASSIGNOP(OPf_STACKED, $1, $2, $3); }
532 | term POWOP term /* $x ** $y */
533 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
534 | term MULOP term /* $x * $y, $x x $y */
535 { if ($2 != OP_REPEAT)
537 $$ = newBINOP($2, 0, $1, scalar($3)); }
538 | term ADDOP term /* $x + $y */
539 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
540 | term SHIFTOP term /* $x >> $y, $x << $y */
541 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
542 | term RELOP term /* $x > $y, etc. */
543 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
544 | term EQOP term /* $x == $y, $x eq $y */
545 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
546 | term BITANDOP term /* $x & $y */
547 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
548 | term BITOROP term /* $x | $y */
549 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
550 | term DOTDOT term /* $x..$y, $x...$y */
551 { $$ = newRANGE($2, scalar($1), scalar($3));}
552 | term ANDAND term /* $x && $y */
553 { $$ = newLOGOP(OP_AND, 0, $1, $3); }
554 | term OROR term /* $x || $y */
555 { $$ = newLOGOP(OP_OR, 0, $1, $3); }
556 | term DORDOR term /* $x // $y */
557 { $$ = newLOGOP(OP_DOR, 0, $1, $3); }
558 | term MATCHOP term /* $x =~ /$y/ */
559 { $$ = bind_match($2, $1, $3); }
562 /* Unary operators and terms */
563 termunop : '-' term %prec UMINUS /* -$x */
564 { $$ = newUNOP(OP_NEGATE, 0, scalar($2)); }
565 | '+' term %prec UMINUS /* +$x */
568 { $$ = newUNOP(OP_NOT, 0, scalar($2)); }
570 { $$ = newUNOP(OP_COMPLEMENT, 0, scalar($2));}
571 | term POSTINC /* $x++ */
572 { $$ = newUNOP(OP_POSTINC, 0,
573 mod(scalar($1), OP_POSTINC)); }
574 | term POSTDEC /* $x-- */
575 { $$ = newUNOP(OP_POSTDEC, 0,
576 mod(scalar($1), OP_POSTDEC)); }
577 | PREINC term /* ++$x */
578 { $$ = newUNOP(OP_PREINC, 0,
579 mod(scalar($2), OP_PREINC)); }
580 | PREDEC term /* --$x */
581 { $$ = newUNOP(OP_PREDEC, 0,
582 mod(scalar($2), OP_PREDEC)); }
586 /* Constructors for anonymous data */
587 anonymous: '[' expr ']'
588 { $$ = newANONLIST($2); }
590 { $$ = newANONLIST(Nullop); }
591 | HASHBRACK expr ';' '}' %prec '(' /* { foo => "Bar" } */
592 { $$ = newANONHASH($2); }
593 | HASHBRACK ';' '}' %prec '(' /* { } (';' by tokener) */
594 { $$ = newANONHASH(Nullop); }
595 | ANONSUB startanonsub proto subattrlist block %prec '('
596 { $$ = newANONATTRSUB($2, $3, $4, $5); }
600 /* Things called with "do" */
601 termdo : DO term %prec UNIOP /* do $filename */
602 { $$ = dofile($2, $1); }
603 | DO block %prec '(' /* do { code */
604 { $$ = newUNOP(OP_NULL, OPf_SPECIAL, scope($2)); }
605 | DO WORD '(' ')' /* do somesub() */
606 { $$ = newUNOP(OP_ENTERSUB,
607 OPf_SPECIAL|OPf_STACKED,
608 prepend_elem(OP_LIST,
610 (OPpENTERSUB_AMPER<<8),
613 | DO WORD '(' expr ')' /* do somesub(@args) */
614 { $$ = newUNOP(OP_ENTERSUB,
615 OPf_SPECIAL|OPf_STACKED,
619 (OPpENTERSUB_AMPER<<8),
622 | DO scalar '(' ')' /* do $subref () */
623 { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
624 prepend_elem(OP_LIST,
625 scalar(newCVREF(0,scalar($2))), Nullop)); dep();}
626 | DO scalar '(' expr ')' /* do $subref (@args) */
627 { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
628 prepend_elem(OP_LIST,
630 scalar(newCVREF(0,scalar($2))))); dep();}
638 | term '?' term ':' term
639 { $$ = newCONDOP(0, $1, $3, $5); }
640 | REFGEN term /* \$x, \@y, \%z */
641 { $$ = newUNOP(OP_REFGEN, 0, mod($2,OP_REFGEN)); }
642 | myattrterm %prec UNIOP
644 | LOCAL term %prec UNIOP
645 { $$ = localize($2,$1); }
647 { $$ = sawparens($2); }
649 { $$ = sawparens(newNULLLIST()); }
658 | arylen %prec '(' /* $#x, $#{ something } */
659 { $$ = newUNOP(OP_AV2ARYLEN, 0, ref($1, OP_AV2ARYLEN));}
662 | ary '[' expr ']' /* array slice */
663 { $$ = prepend_elem(OP_ASLICE,
664 newOP(OP_PUSHMARK, 0),
665 newLISTOP(OP_ASLICE, 0,
667 ref($1, OP_ASLICE))); }
668 | ary '{' expr ';' '}' /* @hash{@keys} */
669 { $$ = prepend_elem(OP_HSLICE,
670 newOP(OP_PUSHMARK, 0),
671 newLISTOP(OP_HSLICE, 0,
673 ref(oopsHV($1), OP_HSLICE)));
674 PL_expect = XOPERATOR; }
678 { $$ = newUNOP(OP_ENTERSUB, 0, scalar($1)); }
679 | amper '(' ')' /* &foo() */
680 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); }
681 | amper '(' expr ')' /* &foo(@args) */
682 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
683 append_elem(OP_LIST, $3, scalar($1))); }
684 | NOAMP WORD listexpr /* foo(@args) */
685 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
686 append_elem(OP_LIST, $3, scalar($2))); }
687 | LOOPEX /* loop exiting command (goto, last, dump, etc) */
688 { $$ = newOP($1, OPf_SPECIAL);
689 PL_hints |= HINT_BLOCK_SCOPE; }
691 { $$ = newLOOPEX($1,$2); }
692 | NOTOP argexpr /* not $foo */
693 { $$ = newUNOP(OP_NOT, 0, scalar($2)); }
694 | UNIOP /* Unary op, $_ implied */
695 { $$ = newOP($1, 0); }
696 | UNIOP block /* eval { foo } */
697 { $$ = newUNOP($1, 0, $2); }
698 | UNIOP term /* Unary op */
699 { $$ = newUNOP($1, 0, $2); }
700 | REQUIRE /* require, $_ implied */
701 { $$ = newOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0); }
702 | REQUIRE term /* require Foo */
703 { $$ = newUNOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0, $2); }
704 | UNIOPSUB term /* Sub treated as unop */
705 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
706 append_elem(OP_LIST, $2, scalar($1))); }
707 | FUNC0 /* Nullary operator */
708 { $$ = newOP($1, 0); }
710 { $$ = newOP($1, 0); }
711 | FUNC0SUB /* Sub treated as nullop */
712 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
714 | FUNC1 '(' ')' /* not () */
715 { $$ = $1 == OP_NOT ? newUNOP($1, 0, newSVOP(OP_CONST, 0, newSViv(0)))
716 : newOP($1, OPf_SPECIAL); }
717 | FUNC1 '(' expr ')' /* not($foo) */
718 { $$ = newUNOP($1, 0, $3); }
719 | PMFUNC '(' argexpr ')' /* m//, s///, tr/// */
720 { $$ = pmruntime($1, $3, 1); }
725 /* "my" declarations, with optional attributes */
726 myattrterm: MY myterm myattrlist
727 { $$ = my_attrs($2,$3); }
729 { $$ = localize($2,$1); }
732 /* Things that can be "my"'d */
733 myterm : '(' expr ')'
734 { $$ = sawparens($2); }
736 { $$ = sawparens(newNULLLIST()); }
745 /* Basic list expressions */
746 listexpr: /* NULL */ %prec PREC_LOW
748 | argexpr %prec PREC_LOW
752 listexprcom: /* NULL */
760 /* A little bit of trickery to make "for my $foo (@bar)" actually be
763 { PL_in_my = 0; $$ = my($1); }
767 { $$ = newCVREF($1,$2); }
771 { $$ = newSVREF($2); }
775 { $$ = newAVREF($2); }
779 { $$ = newHVREF($2); }
782 arylen : DOLSHARP indirob
783 { $$ = newAVREF($2); }
787 { $$ = newGVREF(0,$2); }
790 /* Indirect objects */
793 | scalar %prec PREC_LOW