6 ms·
I studied under Wirth at ETH Zurich in the 1980s, so I got to interact with him personally a number of times. His class on compiler construction was particularl
by microtherion 9y ago
I studied under Wirth at ETH Zurich in the 1980s, so I got to interact with him personally a number of times. His class on compiler construction was particularly interesting. You could see how a philosophy of simplicity and clarity in syntax and semantics would translate to simple and clear compilers.
The downside of this philosophy was that aspects of interacting with a computer that were inherently messy tended to be swept under the rug: The original "file" and "string" concepts as described in early Pascal reports were simply unworkable, and combined with a marked disinterest in language standardization efforts (which I personally suspect stems from Wirth's involvement in Algol 68, although I have no direct evidence) led to each implementation rigging up their own ad hoc solutions.
As a consequence, even TeX, a batch program with no fancy demands on hardware, was not written in strictly "standardized" Pascal, but basically Knuth had to assume the existence of a number of non-standard mechanisms.
- deleted 9y ago[deleted]
- drfuchs 9y agoAs you indicate, the language described in Jensen and Wirth's 1975 "Pascal User Manual" didn't have a way to open files with a name computed at runtime, nor was there a way to close a file. TeX needed to be able to do these things, as well as to have what C programmers would call a "default" case on a switch statement, which was also missing from standard Pascal. Happily, almost all Pascal compilers had these extensions; unhappily, the syntax was not generally agreed upon. Other than that, TeX actually used a strict subset of standard Pascal; quoting module #3 in Volume B of Knuth's Computers & Typesetting: "Indeed, a conscious effort has been made here to avoid using several idiosyncratic features of standard PASCAL itself, so that most of the code can be translated mechanically into other high-level languages. For example, the `with' and `new' features are not used, nor are pointer types, set types, or enumerated scalar types; there are no `var' parameters, except in the case of files; there are no tag fields on variant records; there are no assignments real:=integer; no procedures are declared local to other procedures." As you also say, Pascal had virtually useless string types, but TeX worked around that limitation itself, by managing its own string pool in a single big array of characters, with a second array of pointers to where each string started. A string was identified by its index in the later array. Through careful design and coding, no general garbage collection of strings was necessary, just the ability to forget the most recently-made string.