# Re: Progress on Parsing

• To: dsr@w3.org
• Subject: Re: Progress on Parsing
• From: Neil Soiffer <soiffer@wri.com>
• Date: Thu, 18 Apr 1996 14:57:49 -0700
• Cc: w3c-math-erb@w3.org
• From soiffer@wri.com Thu Apr 18 17: 58:18 1996
• Message-Id: <199604182157.AA01420@drizzle.wri.com>

Dave,

It would be useful for those of us who don't have prolog on our machines
if you would include the sample output along with your sample input.

I am confused how you deal with parens and functions.
I didn't see any definitions for them, and yet two of your leading examples

y = 1 + integral of sin(x) wrt x * cos(x)
1 + {sin a x} over e^x

involve functions ('integral' also seems to be missing from your precedence
list).

In the first example, it would seem that your grammar (assuming parens were
added) would turn 'sin(x)' into 'sin.(x)'
In the second example, how is 'sin a x' parsed:  'sin.a.x' or '{sin a}.x'
or 'sin {a x}'

The rules you give all seem to be left or right associative.
Operators such as '+' and ',' are treated as n-ary operators by the symbolic
manipulators that I've seen because you can often get expressions that
are thousands of "terms" long, and it is very inefficient to build binary
trees for those expressions.

Also, I didn't see anything in your test grammar for dealing with scripted
operators.  Eg, suppose you define:
prefix operator "sum" (or use '-' in place of 'sum' in the example below).
infix operator "cross" (or some other operator with precedence higher than
times but less than prefix minus)

Then
-n cross sum _ i i

should group as
{-{n cross {{sum _ i} i}}}

The interesting thing here is that 'sum _ i' must reduce to a prefix operator
with the same precedence as sum, and then this must grab the 'i' operand
as opposed to treating the operand/operand conflict (...i i) as multiplication.

Neil