Glasgow Haskell Compiler
From Seo Wiki - Search Engine Optimization and Programming Languages
|Developer(s)||University of Glasgow|
|Stable release||6.12.1 / December 14, 2009|
The Glorious Glasgow Haskell Compilation System, more commonly known as the Glasgow Haskell Compiler or GHC, is an open source native code compiler for the functional programming language Haskell. The lead developers are Simon Peyton Jones and Simon Marlow.
GHC originally started in 1989 as a prototype, written in LML (Lazy ML) by Kevin Hammond at the University of Glasgow. Later that year, the prototype was completely rewritten in Haskell, except for its parser, by Cordelia Hall, Will Partain, and Simon Peyton Jones. Its first beta release was on April 1, 1991 and subsequent releases added a strictness analyzer as well as language extensions such as monadic I/O, mutable arrays, unboxed data types, concurrent and parallel programming models (such as software transactional memory and data parallelism) and a profiler.
Peyton Jones, as well as Simon Marlow, later moved to Microsoft Research in Cambridge, England, where they continue to be primarily responsible for developing GHC. GHC also contains code from more than sixty other contributors. Since 2009, third-party contributions to GHC have been funded by the Industrial Haskell Group.
GHC's front end — incorporating the lexer, parser and typechecker — is designed to preserve as much information about the source language as possible until after type inference is complete, toward the goal of providing clear error messages to users. After type checking, the Haskell code is desugared into a typed intermediate language known as "Core" (based on System F, extended with
case expressions). Recently, Core was extended to support generalized algebraic datatypes in its type system, and is now based on an extension to System F known as System FC.
In the tradition of type-directed compilation, GHC's simplifier, or "middle end", where most of the optimizations implemented in GHC are performed, is structured as a series of source-to-source transformations on Core code. The analyses and transformations performed in this compiler stage include demand analysis (a generalization of strictness analysis), application of user-defined rewrite rules (including a set of rules included in GHC's standard libraries that performs foldr/build fusion), unfolding (called "inlining" in more traditional compilers), let-floating, an analysis that determines which function arguments can be unboxed, constructed product result analysis, specialization of overloaded functions, as well as a set of simpler local transformations such as constant folding and beta reduction.
The back end of the compiler transforms Core code into an internal representation of C--, via an intermediate language STG (short for "Spineless Tagless G-machine"). The C-- code can then take one of two routes: either it is printed directly as C code, or it is converted into native machine code (the traditional "code generation" phase).
GHC complies with the latest language standard, called Haskell 98. It also supports many optional extensions to the Haskell standard: for example, the Software transactional memory (STM) library, which allows for Composable Memory Transactions.
Versions of GHC are available for several platforms, including Windows and most varieties of Unix (such as the numerous GNU/Linux flavors, FreeBSD, and Mac OS X). GHC has also been ported to several different processor architectures.
- ↑ ghc --version
- ↑ "The Glorious Glasgow Haskell Compilation System User's Guide, Version 6.6". http://www.haskell.org/ghc/docs/latest/html/users_guide/index.html. Retrieved 2007-01-28.
- ↑ 3.0 3.1 Hudak, P.; Hughes, J.; Peyton Jones, S.; Wadler, P. (June 2007). "A history of Haskell: being lazy with class". Proc. Third ACM SIGPLAN History of Programming Languages Conference (HOPL-III). http://research.microsoft.com/~simonpj/papers/history-of-haskell/index.htm.
- ↑ "The GHC Team". http://cvs.haskell.org/trac/ghc/wiki/Contributors. Retrieved 2007-01-28.
- ↑ Sulzmann, M.; M. M. T. Chakravarty; S. Peyton Jones; K. Donnelly (January 2007). "System F with Type Equality Coercions". Proc. Workshop on Types in Language Design and Implementation (TLDI). http://research.microsoft.com/~simonpj/papers/ext-f/fc-tldi.pdf.
- ↑ Peyton Jones, S. (April 1996). "Compiling Haskell by program transformation: a report from the trenches". Proc. European Symposium on Programming (ESOP). http://citeseer.ist.psu.edu/peytonjones96compiling.html.
- ↑ Peyton Jones, S. (April 1992). "Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine, Version 2.5". Journal of Functional Programming 2 (2): 127–202. doi:10.1017/S0956796800000319. http://citeseer.ist.psu.edu/peytonjones92implementing.html.
- ↑ "Haskell 98 Language and Libraries: The Revised Report". http://www.haskell.org/onlinereport/. Retrieved 2007-01-28.