Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!stern.fokus.gmd.de!zib-berlin.de!zrz.TU-Berlin.DE!fu-berlin.de!news.belwue.de!news.uni-ulm.de!rz.uni-karlsruhe.de!news.uni-stuttgart.de!news.rhrz.uni-bonn.de!RRZ.Uni-Koeln.DE!news.dfn.de!scsing.switch.ch!swsbe6.switch.ch!swidir.switch.ch!in2p3.fr!oleane!simtel!news.kei.com!newsfeed.internetmci.com!usenet.eel.ufl.edu!warwick!yama.mcc.ac.uk!liv!news
From: Bruce Stephens <bruce@liverpool.ac.uk>
Subject: Re: Z-code _compiler_ ???
In-Reply-To: "Andrew C. Plotkin"'s message of Sun, 12 Nov 1995 23:35:59 -0500
Message-ID: <weu446t62a.fsf@iasc3.scm.liv.ac.uk>
Sender: brs@iasc3.scm.liv.ac.uk
Nntp-Posting-Host: iasc3.scm.liv.ac.uk
Organization: IASC, University of Liverpool
X-Newsreader: Gnus v5.0.4
References: <DHyBxo.Evz@news.cern.ch> <Qkdggjq00WB64AeJQV@andrew.cmu.edu>
Date: Wed, 15 Nov 1995 12:29:01 GMT
Lines: 49

>>>>> "Andrew" == Andrew C Plotkin <erkyrath+@CMU.EDU> writes:

> This is not an entirely bizarre proposal. It would probably be
> fairly easy to do -- at least for a generic interpreter. (Your
> Z-to-C translator would output a bunch of C files. You would then
> throw away all the emulator source code from ZIP and plop down those
> in their place; they would use the existing interface source code in
> ZIP.  Compile and run.) People who wanted to run translated games on
> fancy ewmulators would be in trouble.

You could simply translate some of the more interesting operations
into function calls, and supply a library of "standard"
implementations which did straightforward things, allowing particular
ports to add their own.

I don't much like this idea for my own preferred platform (the Psion
Series 3a) for a number of reasons:

1. Although speed is a bit of an issue, for the Infocom games it's OK:
sometimes a second or two between prompts.  For some Inform games it
can be a number of seconds, but I'm willing to put up with that.

2. Most people who have a Series 3a don't have a C compiler for it;
gcc won't work.  There's a shareware C-subset compiler (which actually
runs on the Series 3a) but I suspect it's not up to this.

3. The main reason is space.  I suspect the C code produced is just
going to be too big.  Executables are pretty much limited to 64K (the
best of the interpreters, Bryan Scattergood's, is about 30K); there
are ways of going over this, but it gets complicated.  How big is an
executable formed from Curses (256K) going to be?  I can store 15 or
so of the Infocom games on my 2M Flash SSD, together with an
interpreter; I'll pay time/space trade-offs only to an extent!

> By the way, I object to your emphasis of "compiler". Inform is a
> compiler; it outputs object code, even if nobody's ever built the
> hardware to run it. Your idea outputs source code. (If anyone wants
> to argue that it's possible to build a chip that runs C source
> natively, I will have a good laugh.)

It *is* a compiler; it's merely using C as an intermediate
representation!  A number of compilers for various languages do this.
For that matter, if you regard assembly language as a source language,
so do many C compilers, including gcc.
-- 
Bruce                   Institute of Advanced Scientific Computation
bruce@liv.ac.uk   University of Liverpool
http://supr.scm.liv.ac.uk/~bruce/

