Larry Wall wrote:
That interpretation doesn't help me solve my generic parsing problems,
which is about the relationship of op1 to op2 and op3 in

    op1 a() op2 b() op3 c()

and presumably the same thing for postfixes in the other order.

My idea is to have a term re-writing stage before the precedence
parser does its job. I assume that "chalkboard mathematics" means
term re-writing. Which sort of means that infix:<->($x,$y) is a macro
that expands to infix:<+>($x,prefix:<->($y)).

So here's another question in the same vein.  How would mathematicians
read these (assuming Perl has a factorial postfix operator):

Without implying to actually being a mathematician I'll
give my thoughts on the subject.

    1 + a(x)**2!

That is a poor version the the version below and obviously
depends on the precedence that ! has relative to **.

    1 + a(x)²!

This means to me to square the return value of a(x), then
take the factorial and then add 1. Getting a(x) raised to
2! would require the ! to be superscripted as well. Its ASCII
version would explicitly require a(x)**(2!). So a(x)**2! is
either ambiguous or requires lower precedence for !. My actual
reading of the ASCII version picks a(x) as the operation with
highest precedence and going from there outwards encountering
+ to the left and ** to the right with ** being of higher
precedence. Then I'm left with + to the left and ! to the right
with precedence of ! higher than +.

I hope that helps, TSa.

The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being.   -- Attributed to Hermann Weyl

Reply via email to