The spineless tagless G-machine
FPCA '89 Proceedings of the fourth international conference on Functional programming languages and computer architecture
Unboxed values as first class citizens in a non-strict functional language
Proceedings of the 5th ACM conference on Functional programming languages and computer architecture
A natural semantics for lazy evaluation
POPL '93 Proceedings of the 20th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Abstract models of memory management
FPCA '95 Proceedings of the seventh international conference on Functional programming languages and computer architecture
The spineless tagless G-machine, naturally
ICFP '98 Proceedings of the third ACM SIGPLAN international conference on Functional programming
A transformation-based optimiser for Haskell
Science of Computer Programming - Special issue on the 6th European symposium on programming
Compiling Haskell by Program Transformation: A Report from the Trenches
ESOP '96 Proceedings of the 6th European Symposium on Programming Languages and Systems
Proving the Correctness of the STG Machine
IFL '02 Selected Papers from the 13th International Workshop on Implementation of Functional Languages
A functional correspondence between evaluators and abstract machines
Proceedings of the 5th ACM SIGPLAN international conference on Principles and practice of declaritive programming
Formally deriving an STG machine
Proceedings of the 5th ACM SIGPLAN international conference on Principles and practice of declaritive programming
Secrets of the Glasgow Haskell Compiler inliner
Journal of Functional Programming
Deriving a lazy abstract machine
Journal of Functional Programming
Making a fast curry: push/enter vs. eval/apply for higher-order languages
Proceedings of the ninth ACM SIGPLAN international conference on Functional programming
Theoretical Computer Science
Abstract Computing Machines
Making a fast curry: push/enter vs. eval/apply for higher-order languages
Journal of Functional Programming
Alpha-structural recursion and induction
TPHOLs'05 Proceedings of the 18th international conference on Theorem Proving in Higher Order Logics
A Resource-Aware Semantics and Abstract Machine for a Functional Language with Explicit Deallocation
Electronic Notes in Theoretical Computer Science (ENTCS)
Inter-deriving semantic artifacts for object-oriented programming
Journal of Computer and System Sciences
A systematic derivation of the STG machine verified in Coq
Proceedings of the third ACM Haskell symposium on Haskell
Automatic amortised analysis of dynamic memory allocation for lazy functional programs
Proceedings of the 17th ACM SIGPLAN international conference on Functional programming
Hi-index | 0.00 |
The Spineless Tag-less G-machine (STG machine) was defined as the target abstract machine for compiling the lazy functional language Haskell. It is at the heart of the Glasgow Haskell Compiler (GHC) which is claimed to be the Haskell compiler that generates the most efficient code. A high-level description of the STG machine can be found in Peyton Jones (In Journal of Functional programming, 2(2), 127–202, 1992), Marlow & Peyton Jones (In Sigplan Not., 39(9), 4–5, 2004), and Marlow & Peyton Jones (In Journal of Functional Programming, 16(4–5), 415–449, 2006). Should the reader be interested in a more detailed view, then the only additional information available is the Haskell code of GHC and the C code of its runtime system. It is hard to prove that this machine correctly implements the lazy semantics of Haskell. Part of the problem lies in the fact that the STG machine executes a bare-bones functional language, called STGL, much lower level than Haskell. Therefore, part of the correctness should be—and it is—established by showing that the translation from Haskell to STGL preserves Haskell's semantics. The other part involves showing that the STG machine correctly implements the lazy semantics of STGL. In this paper we provide a step-by-step formal derivation of the STG machine and of its compilation to C, starting from a natural semantics of STGL. Thus, our starting point is higher level than the descriptions found Peyton Jones (In Journal of Functional programming, 2(2), 127–202, 1992) and Marlow & Peyton Jones (In Sigplan Not., 39(9), 4–5, 2004), and our arrival point is lower level than those works. Additionally, there has been substantial changes between the so-called push/enter model of the STG machine described in Peyton Jones (In Journal of Functional programming, 2(2), 127–202, 1992), and the eval/apply model of the STG machine described in Marlow & Peyton Jones (In Sigplan Not., 39(9), 4–5, 2004). So, in fact, we derive two machines instead of one, starting from the same initial semantics. At each step we provide enough intuitions and explanations in order to understand the refinement, and then the formal definitions and statements proving that the derivation step is sound and complete. The main contribution of the paper is to show that an efficient machine such as the STG can be presented, understood, and formally reasoned about at different levels of abstraction.