Re: Compiler construction projects

"Skandinavisches Seminar" <>
26 Jun 2005 11:18:37 -0400

          From comp.compilers

Related articles
Compiler construction projects (Roderick Bloem) (2005-06-02)
Re: Compiler construction projects (TOUATI Sid) (2005-06-02)
Re: Compiler construction projects (Laurence Finston) (2005-06-02)
Re: Compiler construction projects (2005-06-10)
Re: Compiler construction projects (2005-06-12)
Re: Compiler construction projects (Gene) (2005-06-19)
Re: Compiler construction projects (Oliver Bandel) (2005-06-23)
Re: Compiler construction projects (Skandinavisches Seminar) (2005-06-26)
| List of all articles for this month |

From: "Skandinavisches Seminar" <>
Newsgroups: comp.compilers
Date: 26 Jun 2005 11:18:37 -0400
Organization: GWDG, Goettingen
References: 05-06-006 05-06-017 05-06-107
Keywords: courses
Posted-Date: 26 Jun 2005 11:18:37 EDT

"Oliver Bandel" <> schrieb
> Very interesting,


> I didn't know 3DLDF.

I prefer to call it GNU 3DLDF in order to draw attention to the GNU Project
of the Free Software Foundation (, of which it is a part.
Of course, any "attention drawing" is likely to be the other way around,
but great oaks from little acorns grow.

> Where did Knuth describe his work on the scanners in detail?

Knuth doesn't actually make a big deal about his manner of implementing
scanning and parsing. The chapters in _The TeXbook_ and _The METAFONTbook_
are called "How TeX Reads What You Type", and similarly for METAFONT. I
only recognized the analogy to the way Flex and Bison (and lex and yacc, of
course) work in the course of working on the scanner and parser for GNU
3DLDF. In _The TeXbook_, he usually talks about "the eyes" (scanner), "the
mouth" (macro expander) and "the stomach" (parser) of a typesetting animal.
Incidentally, in _The METAFONTbook_, he uses the term "digitalization" to
refer to what is more conventionally called "scan conversion". So his
terminology is sometimes a little idiosyncratic.

The source code for the scanners and parsers, as well as everything else,
are in the volumes _TeX: The Program_ and _METAFONT: The Program_ in the
series "Computers and Typesetting". I've started both several times, but
have never gotten very far. It's first-class programming, but while I
admire it tremendously, it's just not practical for the kind of work I do.
I call it machine language programming in Pascal.

I actually implemented the scanner and parser for 3DLDF purely on the basis
of the simple scanning rules in the above-mentioned chapter of _The
MFbook_, the syntax rules in Backus-Naur form in _The MFbook_, and the GNU
Bison manual. I've never read the Dragon book or any other book on
compilers, and I know virtually nothing about the theory of compilers. I'm
sure it would be very useful and interesting knowledge, but it was possible
to implement a scanner and parser without it.

> [Knuth's 2002 "Selected Papers in Computer Languages" would be a good
> place to start. -John]

There might also be something about it in Knuth's _Digital Typography_.
Some of the references at the beginning of _TeX: The Program_ and _MF:
The Program_ might also be relevant. While Knuth doesn't make a big deal of
these aspects of the programs, I think they are quite interesting. Each is
an excellent example of a different kind of compiler: Seen from one
perspective, TeX is a macro processor and MF is an interpreter. Each has
many of those extra touches that make Knuth's work so special.


Post a followup to this message

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