Put back the cygwin32 Configure fix of 3582 undone by 3597.
[p5sagit/p5-mst-13.2.git] / perly.y
1 /*    perly.y
2  *
3  *    Copyright (c) 1991-1997, Larry Wall
4  *
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.
7  *
8  */
9
10 /*
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.'
13  */
14
15 %{
16 #include "EXTERN.h"
17 #define PERL_IN_PERLY_C
18 #include "perl.h"
19
20 #define dep() deprecate("\"do\" to call subroutines")
21
22 %}
23
24 %start prog
25
26 %{
27 /* I sense a Big Blue pattern here... */
28 #if !defined(OEMVS) && !defined(__OPEN_VM) && !defined(POSIX_BC)
29 %}
30
31 %union {
32     I32 ival;
33     char *pval;
34     OP *opval;
35     GV *gvval;
36 }
37
38 %{
39 #endif /* !OEMVS && !__OPEN_VM && !POSIX_BC */
40
41 #ifdef USE_PURE_BISON
42 #define YYLEX_PARAM (&yychar)
43 #endif
44 %}
45
46 %token <ival> '{' ')'
47
48 %token <opval> WORD METHOD FUNCMETH THING PMFUNC PRIVATEREF
49 %token <opval> FUNC0SUB UNIOPSUB LSTOPSUB
50 %token <pval> LABEL
51 %token <ival> FORMAT SUB ANONSUB PACKAGE USE
52 %token <ival> WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE FOR
53 %token <ival> LOOPEX DOTDOT
54 %token <ival> FUNC0 FUNC1 FUNC UNIOP LSTOP
55 %token <ival> RELOP EQOP MULOP ADDOP
56 %token <ival> DOLSHARP DO HASHBRACK NOAMP
57 %token LOCAL MY
58
59 %type <ival> prog decl local format startsub startanonsub startformsub
60 %type <ival> remember mremember '&'
61 %type <opval> block mblock lineseq line loop cond else
62 %type <opval> expr term scalar ary hsh arylen star amper sideff
63 %type <opval> argexpr nexpr texpr iexpr mexpr mnexpr mtexpr miexpr
64 %type <opval> listexpr listexprcom indirob listop method
65 %type <opval> formname subname proto subbody cont my_scalar
66 %type <pval> label
67
68 %left <ival> OROP
69 %left ANDOP
70 %right NOTOP
71 %nonassoc LSTOP LSTOPSUB
72 %left ','
73 %right <ival> ASSIGNOP
74 %right '?' ':'
75 %nonassoc DOTDOT
76 %left OROR
77 %left ANDAND
78 %left <ival> BITOROP
79 %left <ival> BITANDOP
80 %nonassoc EQOP
81 %nonassoc RELOP
82 %nonassoc UNIOP UNIOPSUB
83 %left <ival> SHIFTOP
84 %left ADDOP
85 %left MULOP
86 %left <ival> MATCHOP
87 %right '!' '~' UMINUS REFGEN
88 %right <ival> POWOP
89 %nonassoc PREINC PREDEC POSTINC POSTDEC
90 %left ARROW
91 %left '('
92
93 %% /* RULES */
94
95 prog    :       /* NULL */
96                 {
97 #if defined(YYDEBUG) && defined(DEBUGGING)
98                     yydebug = (PL_debug & 1);
99 #endif
100                     PL_expect = XSTATE;
101                 }
102         /*CONTINUED*/   lineseq
103                         { newPROG($2); }
104         ;
105
106 block   :       '{' remember lineseq '}'
107                         { if (PL_copline > (line_t)$1)
108                               PL_copline = $1;
109                           $$ = block_end($2, $3); }
110         ;
111
112 remember:       /* NULL */      /* start a full lexical scope */
113                         { $$ = block_start(TRUE); }
114         ;
115
116 mblock  :       '{' mremember lineseq '}'
117                         { if (PL_copline > (line_t)$1)
118                               PL_copline = $1;
119                           $$ = block_end($2, $3); }
120         ;
121
122 mremember:      /* NULL */      /* start a partial lexical scope */
123                         { $$ = block_start(FALSE); }
124         ;
125
126 lineseq :       /* NULL */
127                         { $$ = Nullop; }
128         |       lineseq decl
129                         { $$ = $1; }
130         |       lineseq line
131                         {   $$ = append_list(OP_LINESEQ,
132                                 (LISTOP*)$1, (LISTOP*)$2);
133                             PL_pad_reset_pending = TRUE;
134                             if ($1 && $2) PL_hints |= HINT_BLOCK_SCOPE; }
135         ;
136
137 line    :       label cond
138                         { $$ = newSTATEOP(0, $1, $2); }
139         |       loop    /* loops add their own labels */
140         |       label ';'
141                         { if ($1 != Nullch) {
142                               $$ = newSTATEOP(0, $1, newOP(OP_NULL, 0));
143                             }
144                             else {
145                               $$ = Nullop;
146                               PL_copline = NOLINE;
147                             }
148                             PL_expect = XSTATE; }
149         |       label sideff ';'
150                         { $$ = newSTATEOP(0, $1, $2);
151                           PL_expect = XSTATE; }
152         ;
153
154 sideff  :       error
155                         { $$ = Nullop; }
156         |       expr
157                         { $$ = $1; }
158         |       expr IF expr
159                         { $$ = newLOGOP(OP_AND, 0, $3, $1); }
160         |       expr UNLESS expr
161                         { $$ = newLOGOP(OP_OR, 0, $3, $1); }
162         |       expr WHILE expr
163                         { $$ = newLOOPOP(OPf_PARENS, 1, scalar($3), $1); }
164         |       expr UNTIL iexpr
165                         { $$ = newLOOPOP(OPf_PARENS, 1, $3, $1);}
166         |       expr FOR expr
167                         { $$ = newFOROP(0, Nullch, $2,
168                                         Nullop, $3, $1, Nullop); }
169         ;
170
171 else    :       /* NULL */
172                         { $$ = Nullop; }
173         |       ELSE mblock
174                         { $$ = scope($2); }
175         |       ELSIF '(' mexpr ')' mblock else
176                         { PL_copline = $1;
177                             $$ = newSTATEOP(0, Nullch,
178                                    newCONDOP(0, $3, scope($5), $6));
179                             PL_hints |= HINT_BLOCK_SCOPE; }
180         ;
181
182 cond    :       IF '(' remember mexpr ')' mblock else
183                         { PL_copline = $1;
184                             $$ = block_end($3,
185                                    newCONDOP(0, $4, scope($6), $7)); }
186         |       UNLESS '(' remember miexpr ')' mblock else
187                         { PL_copline = $1;
188                             $$ = block_end($3,
189                                    newCONDOP(0, $4, scope($6), $7)); }
190         ;
191
192 cont    :       /* NULL */
193                         { $$ = Nullop; }
194         |       CONTINUE block
195                         { $$ = scope($2); }
196         ;
197
198 loop    :       label WHILE '(' remember mtexpr ')' mblock cont
199                         { PL_copline = $2;
200                             $$ = block_end($4,
201                                    newSTATEOP(0, $1,
202                                      newWHILEOP(0, 1, (LOOP*)Nullop,
203                                                 $2, $5, $7, $8))); }
204         |       label UNTIL '(' remember miexpr ')' mblock cont
205                         { PL_copline = $2;
206                             $$ = block_end($4,
207                                    newSTATEOP(0, $1,
208                                      newWHILEOP(0, 1, (LOOP*)Nullop,
209                                                 $2, $5, $7, $8))); }
210         |       label FOR MY remember my_scalar '(' mexpr ')' mblock cont
211                         { $$ = block_end($4,
212                                  newFOROP(0, $1, $2, $5, $7, $9, $10)); }
213         |       label FOR scalar '(' remember mexpr ')' mblock cont
214                         { $$ = block_end($5,
215                                  newFOROP(0, $1, $2, mod($3, OP_ENTERLOOP),
216                                           $6, $8, $9)); }
217         |       label FOR '(' remember mexpr ')' mblock cont
218                         { $$ = block_end($4,
219                                  newFOROP(0, $1, $2, Nullop, $5, $7, $8)); }
220         |       label FOR '(' remember mnexpr ';' mtexpr ';' mnexpr ')' mblock
221                         /* basically fake up an initialize-while lineseq */
222                         { OP *forop = append_elem(OP_LINESEQ,
223                                         scalar($5),
224                                         newWHILEOP(0, 1, (LOOP*)Nullop,
225                                                    $2, scalar($7),
226                                                    $11, scalar($9)));
227                           PL_copline = $2;
228                           $$ = block_end($4, newSTATEOP(0, $1, forop)); }
229         |       label block cont  /* a block is a loop that happens once */
230                         { $$ = newSTATEOP(0, $1,
231                                  newWHILEOP(0, 1, (LOOP*)Nullop,
232                                             NOLINE, Nullop, $2, $3)); }
233         ;
234
235 nexpr   :       /* NULL */
236                         { $$ = Nullop; }
237         |       sideff
238         ;
239
240 texpr   :       /* NULL means true */
241                         { (void)scan_num("1"); $$ = yylval.opval; }
242         |       expr
243         ;
244
245 iexpr   :       expr
246                         { $$ = invert(scalar($1)); }
247         ;
248
249 mexpr   :       expr
250                         { $$ = $1; intro_my(); }
251         ;
252
253 mnexpr  :       nexpr
254                         { $$ = $1; intro_my(); }
255         ;
256
257 mtexpr  :       texpr
258                         { $$ = $1; intro_my(); }
259         ;
260
261 miexpr  :       iexpr
262                         { $$ = $1; intro_my(); }
263         ;
264
265 label   :       /* empty */
266                         { $$ = Nullch; }
267         |       LABEL
268         ;
269
270 decl    :       format
271                         { $$ = 0; }
272         |       subrout
273                         { $$ = 0; }
274         |       package
275                         { $$ = 0; }
276         |       use
277                         { $$ = 0; }
278         ;
279
280 format  :       FORMAT startformsub formname block
281                         { newFORM($2, $3, $4); }
282         ;
283
284 formname:       WORD            { $$ = $1; }
285         |       /* NULL */      { $$ = Nullop; }
286         ;
287
288 subrout :       SUB startsub subname proto subbody
289                         { newSUB($2, $3, $4, $5); }
290         ;
291
292 startsub:       /* NULL */      /* start a regular subroutine scope */
293                         { $$ = start_subparse(FALSE, 0); }
294         ;
295
296 startanonsub:   /* NULL */      /* start an anonymous subroutine scope */
297                         { $$ = start_subparse(FALSE, CVf_ANON); }
298         ;
299
300 startformsub:   /* NULL */      /* start a format subroutine scope */
301                         { $$ = start_subparse(TRUE, 0); }
302         ;
303
304 subname :       WORD    { STRLEN n_a; char *name = SvPV(((SVOP*)$1)->op_sv,n_a);
305                           if (strEQ(name, "BEGIN") || strEQ(name, "END")
306                               || strEQ(name, "INIT"))
307                               CvSPECIAL_on(PL_compcv);
308                           $$ = $1; }
309         ;
310
311 proto   :       /* NULL */
312                         { $$ = Nullop; }
313         |       THING
314         ;
315
316 subbody :       block   { $$ = $1; }
317         |       ';'     { $$ = Nullop; PL_expect = XSTATE; }
318         ;
319
320 package :       PACKAGE WORD ';'
321                         { package($2); }
322         |       PACKAGE ';'
323                         { package(Nullop); }
324         ;
325
326 use     :       USE startsub
327                         { CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ }
328                     WORD WORD listexpr ';'
329                         { utilize($1, $2, $4, $5, $6); }
330         ;
331
332 expr    :       expr ANDOP expr
333                         { $$ = newLOGOP(OP_AND, 0, $1, $3); }
334         |       expr OROP expr
335                         { $$ = newLOGOP($2, 0, $1, $3); }
336         |       argexpr
337         ;
338
339 argexpr :       argexpr ','
340                         { $$ = $1; }
341         |       argexpr ',' term
342                         { $$ = append_elem(OP_LIST, $1, $3); }
343         |       term
344         ;
345
346 listop  :       LSTOP indirob argexpr
347                         { $$ = convert($1, OPf_STACKED,
348                                 prepend_elem(OP_LIST, newGVREF($1,$2), $3) ); }
349         |       FUNC '(' indirob expr ')'
350                         { $$ = convert($1, OPf_STACKED,
351                                 prepend_elem(OP_LIST, newGVREF($1,$3), $4) ); }
352         |       term ARROW method '(' listexprcom ')'
353                         { $$ = convert(OP_ENTERSUB, OPf_STACKED,
354                                 append_elem(OP_LIST,
355                                     prepend_elem(OP_LIST, scalar($1), $5),
356                                     newUNOP(OP_METHOD, 0, $3))); }
357         |       term ARROW method
358                         { $$ = convert(OP_ENTERSUB, OPf_STACKED,
359                                 append_elem(OP_LIST, scalar($1),
360                                     newUNOP(OP_METHOD, 0, $3))); }
361         |       METHOD indirob listexpr
362                         { $$ = convert(OP_ENTERSUB, OPf_STACKED,
363                                 append_elem(OP_LIST,
364                                     prepend_elem(OP_LIST, $2, $3),
365                                     newUNOP(OP_METHOD, 0, $1))); }
366         |       FUNCMETH indirob '(' listexprcom ')'
367                         { $$ = convert(OP_ENTERSUB, OPf_STACKED,
368                                 append_elem(OP_LIST,
369                                     prepend_elem(OP_LIST, $2, $4),
370                                     newUNOP(OP_METHOD, 0, $1))); }
371         |       LSTOP listexpr
372                         { $$ = convert($1, 0, $2); }
373         |       FUNC '(' listexprcom ')'
374                         { $$ = convert($1, 0, $3); }
375         |       LSTOPSUB startanonsub block
376                         { $3 = newANONSUB($2, 0, $3); }
377                     listexpr            %prec LSTOP
378                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
379                                  append_elem(OP_LIST,
380                                    prepend_elem(OP_LIST, $3, $5), $1)); }
381         ;
382
383 method  :       METHOD
384         |       scalar
385         ;
386
387 term    :       term ASSIGNOP term
388                         { $$ = newASSIGNOP(OPf_STACKED, $1, $2, $3); }
389         |       term POWOP term
390                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
391         |       term MULOP term
392                         {   if ($2 != OP_REPEAT)
393                                 scalar($1);
394                             $$ = newBINOP($2, 0, $1, scalar($3)); }
395         |       term ADDOP term
396                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
397         |       term SHIFTOP term
398                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
399         |       term RELOP term
400                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
401         |       term EQOP term
402                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
403         |       term BITANDOP term
404                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
405         |       term BITOROP term
406                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
407         |       term DOTDOT term
408                         { $$ = newRANGE($2, scalar($1), scalar($3));}
409         |       term ANDAND term
410                         { $$ = newLOGOP(OP_AND, 0, $1, $3); }
411         |       term OROR term
412                         { $$ = newLOGOP(OP_OR, 0, $1, $3); }
413         |       term '?' term ':' term
414                         { $$ = newCONDOP(0, $1, $3, $5); }
415         |       term MATCHOP term
416                         { $$ = bind_match($2, $1, $3); }
417
418         |       '-' term %prec UMINUS
419                         { $$ = newUNOP(OP_NEGATE, 0, scalar($2)); }
420         |       '+' term %prec UMINUS
421                         { $$ = $2; }
422         |       '!' term
423                         { $$ = newUNOP(OP_NOT, 0, scalar($2)); }
424         |       '~' term
425                         { $$ = newUNOP(OP_COMPLEMENT, 0, scalar($2));}
426         |       REFGEN term
427                         { $$ = newUNOP(OP_REFGEN, 0, mod($2,OP_REFGEN)); }
428         |       term POSTINC
429                         { $$ = newUNOP(OP_POSTINC, 0,
430                                         mod(scalar($1), OP_POSTINC)); }
431         |       term POSTDEC
432                         { $$ = newUNOP(OP_POSTDEC, 0,
433                                         mod(scalar($1), OP_POSTDEC)); }
434         |       PREINC term
435                         { $$ = newUNOP(OP_PREINC, 0,
436                                         mod(scalar($2), OP_PREINC)); }
437         |       PREDEC term
438                         { $$ = newUNOP(OP_PREDEC, 0,
439                                         mod(scalar($2), OP_PREDEC)); }
440         |       local term      %prec UNIOP
441                         { $$ = localize($2,$1); }
442         |       '(' expr ')'
443                         { $$ = sawparens($2); }
444         |       '(' ')'
445                         { $$ = sawparens(newNULLLIST()); }
446         |       '[' expr ']'                            %prec '('
447                         { $$ = newANONLIST($2); }
448         |       '[' ']'                                 %prec '('
449                         { $$ = newANONLIST(Nullop); }
450         |       HASHBRACK expr ';' '}'                  %prec '('
451                         { $$ = newANONHASH($2); }
452         |       HASHBRACK ';' '}'                               %prec '('
453                         { $$ = newANONHASH(Nullop); }
454         |       ANONSUB startanonsub proto block                %prec '('
455                         { $$ = newANONSUB($2, $3, $4); }
456         |       scalar  %prec '('
457                         { $$ = $1; }
458         |       star '{' expr ';' '}'
459                         { $$ = newBINOP(OP_GELEM, 0, $1, scalar($3)); }
460         |       star    %prec '('
461                         { $$ = $1; }
462         |       scalar '[' expr ']'     %prec '('
463                         { $$ = newBINOP(OP_AELEM, 0, oopsAV($1), scalar($3)); }
464         |       term ARROW '[' expr ']' %prec '('
465                         { $$ = newBINOP(OP_AELEM, 0,
466                                         ref(newAVREF($1),OP_RV2AV),
467                                         scalar($4));}
468         |       term '[' expr ']'       %prec '('
469                         { assertref($1); $$ = newBINOP(OP_AELEM, 0,
470                                         ref(newAVREF($1),OP_RV2AV),
471                                         scalar($3));}
472         |       hsh     %prec '('
473                         { $$ = $1; }
474         |       ary     %prec '('
475                         { $$ = $1; }
476         |       arylen  %prec '('
477                         { $$ = newUNOP(OP_AV2ARYLEN, 0, ref($1, OP_AV2ARYLEN));}
478         |       scalar '{' expr ';' '}' %prec '('
479                         { $$ = newBINOP(OP_HELEM, 0, oopsHV($1), jmaybe($3));
480                             PL_expect = XOPERATOR; }
481         |       term ARROW '{' expr ';' '}'     %prec '('
482                         { $$ = newBINOP(OP_HELEM, 0,
483                                         ref(newHVREF($1),OP_RV2HV),
484                                         jmaybe($4));
485                             PL_expect = XOPERATOR; }
486         |       term '{' expr ';' '}'   %prec '('
487                         { assertref($1); $$ = newBINOP(OP_HELEM, 0,
488                                         ref(newHVREF($1),OP_RV2HV),
489                                         jmaybe($3));
490                             PL_expect = XOPERATOR; }
491         |       '(' expr ')' '[' expr ']'       %prec '('
492                         { $$ = newSLICEOP(0, $5, $2); }
493         |       '(' ')' '[' expr ']'    %prec '('
494                         { $$ = newSLICEOP(0, $4, Nullop); }
495         |       ary '[' expr ']'        %prec '('
496                         { $$ = prepend_elem(OP_ASLICE,
497                                 newOP(OP_PUSHMARK, 0),
498                                     newLISTOP(OP_ASLICE, 0,
499                                         list($3),
500                                         ref($1, OP_ASLICE))); }
501         |       ary '{' expr ';' '}'    %prec '('
502                         { $$ = prepend_elem(OP_HSLICE,
503                                 newOP(OP_PUSHMARK, 0),
504                                     newLISTOP(OP_HSLICE, 0,
505                                         list($3),
506                                         ref(oopsHV($1), OP_HSLICE)));
507                             PL_expect = XOPERATOR; }
508         |       THING   %prec '('
509                         { $$ = $1; }
510         |       amper
511                         { $$ = newUNOP(OP_ENTERSUB, 0, scalar($1)); }
512         |       amper '(' ')'
513                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); }
514         |       amper '(' expr ')'
515                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
516                             append_elem(OP_LIST, $3, scalar($1))); }
517         |       NOAMP WORD listexpr
518                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
519                             append_elem(OP_LIST, $3, scalar($2))); }
520         |       DO term %prec UNIOP
521                         { $$ = dofile($2); }
522         |       DO block        %prec '('
523                         { $$ = newUNOP(OP_NULL, OPf_SPECIAL, scope($2)); }
524         |       DO WORD '(' ')'
525                         { $$ = newUNOP(OP_ENTERSUB,
526                             OPf_SPECIAL|OPf_STACKED,
527                             prepend_elem(OP_LIST,
528                                 scalar(newCVREF(
529                                     (OPpENTERSUB_AMPER<<8),
530                                     scalar($2)
531                                 )),Nullop)); dep();}
532         |       DO WORD '(' expr ')'
533                         { $$ = newUNOP(OP_ENTERSUB,
534                             OPf_SPECIAL|OPf_STACKED,
535                             append_elem(OP_LIST,
536                                 $4,
537                                 scalar(newCVREF(
538                                     (OPpENTERSUB_AMPER<<8),
539                                     scalar($2)
540                                 )))); dep();}
541         |       DO scalar '(' ')'
542                         { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
543                             prepend_elem(OP_LIST,
544                                 scalar(newCVREF(0,scalar($2))), Nullop)); dep();}
545         |       DO scalar '(' expr ')'
546                         { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
547                             prepend_elem(OP_LIST,
548                                 $4,
549                                 scalar(newCVREF(0,scalar($2))))); dep();}
550         |       term ARROW '(' ')'      %prec '('
551                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
552                                    newCVREF(0, scalar($1))); }
553         |       term ARROW '(' expr ')' %prec '('
554                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
555                                    append_elem(OP_LIST, $4,
556                                        newCVREF(0, scalar($1)))); }
557         |       LOOPEX
558                         { $$ = newOP($1, OPf_SPECIAL);
559                             PL_hints |= HINT_BLOCK_SCOPE; }
560         |       LOOPEX term
561                         { $$ = newLOOPEX($1,$2); }
562         |       NOTOP argexpr
563                         { $$ = newUNOP(OP_NOT, 0, scalar($2)); }
564         |       UNIOP
565                         { $$ = newOP($1, 0); }
566         |       UNIOP block
567                         { $$ = newUNOP($1, 0, $2); }
568         |       UNIOP term
569                         { $$ = newUNOP($1, 0, $2); }
570         |       UNIOPSUB term
571                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
572                             append_elem(OP_LIST, $2, scalar($1))); }
573         |       FUNC0
574                         { $$ = newOP($1, 0); }
575         |       FUNC0 '(' ')'
576                         { $$ = newOP($1, 0); }
577         |       FUNC0SUB
578                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
579                                 scalar($1)); }
580         |       FUNC1 '(' ')'
581                         { $$ = newOP($1, OPf_SPECIAL); }
582         |       FUNC1 '(' expr ')'
583                         { $$ = newUNOP($1, 0, $3); }
584         |       PMFUNC '(' term ')'
585                         { $$ = pmruntime($1, $3, Nullop); }
586         |       PMFUNC '(' term ',' term ')'
587                         { $$ = pmruntime($1, $3, $5); }
588         |       WORD
589         |       listop
590         ;
591
592 listexpr:       /* NULL */
593                         { $$ = Nullop; }
594         |       argexpr
595                         { $$ = $1; }
596         ;
597
598 listexprcom:    /* NULL */
599                         { $$ = Nullop; }
600         |       expr
601                         { $$ = $1; }
602         |       expr ','
603                         { $$ = $1; }
604         ;
605
606 local   :       LOCAL   { $$ = 0; }
607         |       MY      { $$ = 1; }
608         ;
609
610 my_scalar:      scalar
611                         { PL_in_my = 0; $$ = my($1); }
612         ;
613
614 amper   :       '&' indirob
615                         { $$ = newCVREF($1,$2); }
616         ;
617
618 scalar  :       '$' indirob
619                         { $$ = newSVREF($2); }
620         ;
621
622 ary     :       '@' indirob
623                         { $$ = newAVREF($2); }
624         ;
625
626 hsh     :       '%' indirob
627                         { $$ = newHVREF($2); }
628         ;
629
630 arylen  :       DOLSHARP indirob
631                         { $$ = newAVREF($2); }
632         ;
633
634 star    :       '*' indirob
635                         { $$ = newGVREF(0,$2); }
636         ;
637
638 indirob :       WORD
639                         { $$ = scalar($1); }
640         |       scalar
641                         { $$ = scalar($1);  }
642         |       block
643                         { $$ = scope($1); }
644
645         |       PRIVATEREF
646                         { $$ = $1; }
647         ;
648
649 %% /* PROGRAM */