develooper Front page | perl.perl5.porters | Postings from July 2010

Re: Order of evaluation of terms (was peephole optimiser could prune more dead code)

Thread Previous | Thread Next
From:
Eric Brine
Date:
July 15, 2010 13:11
Subject:
Re: Order of evaluation of terms (was peephole optimiser could prune more dead code)
Message ID:
AANLkTinLN4nQU4zytnvakorV1oqjRzQEXOHQfWam5RFi@mail.gmail.com
On Thu, Jul 15, 2010 at 12:25 PM, David Golden <xdaveg@gmail.com> wrote:

> On Thu, Jul 15, 2010 at 11:51 AM, Eric Brine <ikegami@adaelis.com> wrote:
> > Functions calls are not on the precedence table. They are considered
> terms
> > (not operators) at the grammar level.
>
> From perlop:
>
>   Terms and List Operators (Leftward)
>       A TERM has the highest precedence in Perl.


Precedence is used to determine what are an operator's operands.

Example, prefix unary operator, !:

! TERM1 OP1 TERM2 OP2 TERM3
Is the operand TERM1?
Is the operand TERM1 OP1 TERM2?
Is the operand TERM1 OP1 TERM2 OP2 TERM3?

Example, infix binary operator, +:

TERM1 OP1 TERM2 + TERM3 OP2 TERM4
Is the LHS operand TERM2?
Is the LHS operand TERM1 OP1 TERM2?
Is the RHS operand TERM3?
Is the RHS operand TERM3 OP2 TERM4?

That passage from perlop is odd. Terms have no operands, so it doesn't make
sense to talk of their precedence. Whether they have high or low precedence
doesn't change a thing.

- Eric Brine

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About