# The Spineless Tagless G-machine: detailed paper


The following paper (aka "The Monster") is available by FTP from

ftp.dcs.glasgow.ac.uk:
pub/glasgow-fp/papers/spineless-tagless-gmachine.dvi

In the same directory you'll find various other papers from our
group.  Their titles are summarised in the file PAPER_LIST.

Simon PJ, University of Glasgow.

Implementing lazy functional languages on stock hardware:
the Spineless Tagless G-machine
Version 2.4

Simon L Peyton Jones, University of Glasgow

The Spineless Tagless G-machine is an abstract machine designed to support
non-strict higher-order functional languages.  This presentation of the
machine falls into three parts.  Firstly, we give a general discussion of
the design issues involved in implementing non-strict functional languages,
which is intended to set the STG machine in a wider context.

Next, we present the {\em STG language}, an austere but
recognisably-functional language, which as well as a {\em denotational}
meaning has a well-defined {\em operational} semantics.  The STG language is
the abstract machine code'' for the Spineless Tagless G-machine.

Lastly, we discuss the mapping of the STG language onto stock hardware.  The
success of an abstract machine model depends largely on how efficient this
mapping can be made, though this topic is often relegated to a short
section.  Instead, we give a detailed discussion of the design issues and
the choices we have made.  Our principal target is the C language, treating
the C compiler as a portable assembler.

This is a very long and detailed paper (82 pages), and it gives away all
our trade secrets!  It is to appear in the Journal of Functional Programing.