Re: TeX syntax?

glen herrmannsfeldt <gah@ugcs.caltech.edu>
9 Feb 2007 09:00:30 -0500

          From comp.compilers

Related articles
TeX syntax? rjshaw@netspace.net.au (Russell Shaw) (2007-02-08)
Re: TeX syntax? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2007-02-09)
Re: TeX syntax? adrian@cs.rhul.ac.uk (A Johnstone) (2007-02-09)
Re: TeX syntax? ara@nestle.csail.mit.edu (Allan Adler) (2007-02-09)
Re: TeX syntax? phlucas@f-m.fm (Philipp Lucas) (2007-02-12)
Re: TeX syntax? jhallen@TheWorld.com (2007-02-16)
Re: TeX syntax? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2007-02-16)
Re: TeX syntax? jhallen@TheWorld.com (2007-02-25)
[1 later articles]
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: 9 Feb 2007 09:00:30 -0500
Organization: Compilers Central
References: 07-02-024
Keywords: macros
Posted-Date: 09 Feb 2007 09:00:30 EST

Russell Shaw wrote:


> I've looked high and low without success. Where can i find
> something resembling the BNF of Knuth's TeX typesetting syntax?


Most of what is described in the TeXbook is plain TeX, which uses many
macros in plain.tex. I believe the book describes as primitives those
that are actually built in to the processor before any macros are
loaded (virtex).


> What symbols are fundamental, and what ones are derived?


As I mentioned earlier today in another newsgroup, TeX can't be
compiled. Among the things that can be changed are which characters
are letters and which are not. That can be changed just about up to
the point that they are read in and processed. You can't even say
what a symbol is until you have described which characters are
letters.


> Knuths TeX book mumbles something about "registers" that hold things
> like page numbers or whatever. Where is there a complete list of
> these registers, uses, and limitations?


I believe the fundamental integer registers are \count0 through
\count255, but most that are actually used are defined through macros.
The TeXbook describes them pretty well.


> Knuths TeX book is an abomination, describing lexing and parsing as
> mouth, gullet and stomach nonsense.


That is pretty important, as in some cases macros change things
just before they are used. If you get it wrong, they are changed
too late. Consider \def\x{\y}\x is x defined before it is
expanded, or not? How about \def\x{\y} \x ?


In some places white space is significant, and others it is not.
That is not going to be easy to do in BNF.


-- glen



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.