On Tue, Nov 13, 2001 at 05:21:59AM -0600, Lee Killough wrote:
> Well, you can write recursive descent parsers, LR(1) parsers (yacc, bison,
> etc.).

You can't. You can't parse TeX cleanly without context. There might
be macro, active characters, "unusual" catcodes and thing like that.

Ideally, you would have to run through everything TeX would have seen
until it comes to the expression itself. Of course one could made
"normalizing assumptions" (like "no catcode changes"), but even than the
scope of \over is not exactly trivial. 

> It's not _that_ hard to parse.

Short of re-implementing TeX itself I see no clean solution.

> I did not have \over with complicated expressions in them -- that was
> always \frac.
> 
> perl -e 'while(<>){s/(\d+)\s*\\over\s+(\d+)/\\frac{$1}{$2}/g;print;}'

This one fails already on '1\over2' or '1 + 2\over 3'.

Andre'

-- 
Andr� P�nitz .............................................. [EMAIL PROTECTED]

Reply via email to