Re: Questions on In Scope for INFORM


5 Apr 95 15:08:34 +0100

In article <GDR11.95Apr4222823@stint.cl.cam.ac.uk>, gdr11@cl.cam.ac.uk (Gareth Rees) writes:
> Greg Ewing <greg@cosc.canterbury.ac.nz> wrote:
>> I hate to think what this implies about how Inform's source parser
>> works...
>
> The Inform compiler was written by someone for whom the terms `lexical
> analysis', `LR(1) parser', `context-free language' and `recursive
> descent' are just distant whisperings in the ivory towers of computer
> science. As such, it is a work of art!

Actually, for me part of the fun of it was inventing all the algorithms.
I think it may be safe to say that the expression evaluator is especially,
ahem, innovative.

> Incidentally, the curious design of the Inform parser makes it possible
> for it to run on machines with small memories. Whereas a more
> superficially sophisticated tool like GCC tries to keep the entire
> syntax tree in memory (so that it can do basic-block analysis, dataflow
> analysis, common subexpression elimination and so on), Inform attempts
> to parse the source a line at a time. While this may cause it sometimes
> to run into problems with complicated expressions, it usually does the
> right thing!

It was, though, a deliberate design decision to minimise (a) memory
usage and (b) C stack usage (a significant issue on some of Inform's
ports), which is why there are almost no recursive algorithms anywhere
in the compiler. True, it does very little optimisation (and that only
at a very low level) but it is designing programs for an environment
where this is quite unnecessary.

And it compiles the 18,500 lines of Curses source in 127 seconds on
my Archimedes, which is well over twice as fast per line as my C
compiler can manage.

Anyway, what do all these professionals know? Hah. Amateurs
forever,

J. Meldrew (Miss)