in reply to Re: Where does $4 come from here?
in thread Where does $4 come from here?

My understanding is that:

$1 $2 $3 supposed to refer to the 3 elements on the right of the production.

While $$ refer to the LHS of the production. But in this production, there're only 3 elements on the right hand side, and I don't see what $4 refers to...

Replies are listed 'Best First'.
Re^3: Where does $4 come from here?
by Anonymous Monk on Jul 27, 2011 at 08:11 UTC

    But in this production, there're only 3 elements on the right hand side, and I don't see what $4 refers to...

    Ok, here is more guessing, if we're talking about GRAMPROG  remember stmtseq and

    remember: /* NULL */ /* start a full lexical scope */ { $$ = block_start(TRUE); } ; stmtseq : /* NULL */ { $$ = (OP*)NULL; } | stmtseq fullstmt { $$ = op_append_list(OP_LINESEQ, $1, $2); PL_pad_reset_pending = TRUE; if ($1 && $2) PL_hints |= HINT_BLOCK_SCOPE; } ;
    then surely $$ = op_append_list(OP_LINESEQ, $1, $2); becomes $2, $3, $4, right?

    :)

      No, that's not how yacc works AFAIK...