When I started computing (in 1963) I thought a teletype was a wonderful
device. Give or take the odd extra case, almost all computer scientists still
think so - the presentation of computer programs is STILL determined by the
ways in which electro-mechanical devices could put marks on pieces of paper,
and for that matter, what is taught as the "theory" of computer languages is
still too often about how a sequence of ascii characters can be parsed.
Strangely, the rest of the world has moved on, and communes daily with bitmap
displays and laser printers. *Pantechnicon* is an attempt to persuade
programmers that they actually live in 1993. Essentially, it supports
a mapping from the abstract syntax (AS) of a program to typographical abstract
syntax (TAS), which is then displayed using the capabilities of a modern
machine. TAS is loosely based on TEX, but of course is a datatype not
a concrete syntax.
The latest version, under development at Glasgow, and funded by HMG is, in a
broad sense, object oriented in a modern (i.e. Hindley-Milner typed)
functional context. It is intended to be used to present *any* programming
language in a style which is uniform across standard programming constructs.
Object orientation is implemented by *method maps* which have the type
signature (SML convention)
Identifier -> 'a Expr -> 'a Style -> TAS
Uniformity of presentation is derived by inheritance of a standard suite of
methods, for presenting constructs like addition, while-loops, conditionals.
To define a presenter for a given language, a parser is needed, together with
methods for constructs whose detail is usually specific to the language,
like for-loops and function/procedure definitions.
The default treatment of identifiers is to parse the identifier into
<root>_<suffix>. Thus x_max parses into x and max. Both root and suffix
may then be mapped into non-ascii characters. E.g. alpha is mapped into the
greek symbol. This mapping is "soft" and carried in a Style record (my first
attempt to present C had int mapped into the integral sign, since I was using
a mathematical map derived from Latex...).
Robin Popplestone.
|