Print

Print


David Carlisle wrote --

>
> Of course you can follow the above to its logical conclusion of
> implementing _everything_ via active characters and implementing your
> own parsing routines _in_ TeX rather than using the parser built into
> tex-the-program.

Take care or the project will have to pay royalties to a certain
fellow-country person of ours for even mentioning the possibility:-).

> This is certainly possible (some people have done
> exactly that) but TeX isn't really the best language for implementing a
> parser, and certainly isn't the fastest. If more involved contextual
> analysis is required in the input stream then it probably makes more
> sense to look to an extended system that can provide such extended
> functionality. (Something like omega's OTP processes.) They may not be
> quite what you want here, but the principle is the same, to make a
> controlled extension of the underlying system rather than try to build a
> tower of macros on the rather fragile sand that is tex-the-program.

This suggests two very useful exercises for our readers:

1.  Implement "smart quotes" using OTPs (or show why this is not
possible or is a good way to do it).

2.  Give a reasonably full spec for an extension to TeX's input
character processing that would support clean and elegant
implementation of this and similar functionality.

NOTE: these exercises are not a joke. As Frank, David and I have been
trying to state, perhaps too subtly, this kind of exercise is one
important part (there are many others) of what is needed to make
LaTeX3 happen in the current TeX world.

By contrast, clever TeX code showing that "TeX can do it" is not so
useful, right now, for this type of parsing problem: since TeX (and
even its expansion mechanism alone) is Turing complete "TeX can do all
parsing and string manipulation".


chris