On Wed, Mar 26, 2008 at 07:43:16PM +0100, TSa wrote:
> HaloO,
>
> Larry Wall wrote:
>> That's what I thought.  Now note that ! can't easily be rewritten
>> as a simple binary operator (unless you do something recursive, and
>> then it's not simple).
>
> Would $x! == [*]1..$x constitute simple parserwise? Admittedly
> it's not a single but two ops and one of them a meta.

I meant there's no $x!0 corresponding to 0-$x in the prefix:<-> rewrite.

>> Now, I think I know how to make the parser use precedence on either
>> a prefix or a postfix to get the desired effect (but perhaps not going
>> both directions simulatenously).
>
>
>>  But that leads me to a slightly
>> different parsing question, which comes from the asymmetry of postfix
>> operators.
>
> How are postfix operators asymmetric?

Prefix ops can be followed by whitespace, while postfix may not
be preceded by whitespace.  Also, the presence of sigils makes
it less likely to need space on the front unless you use an
alphabetic prefix operator on something starting alphanumeric:

    abs 1-$x

The asymmetry is essentially that we can't just write

    1-$x abs

without parsing abs as an infix rather than a postfix.  (And please
don't suggest parsing infixes with optional nullterms on the right;
we tried that once, and it screws up the term/infix expectations
rather badly.)

Larry

Reply via email to