Glasgow Haskell Compiler

From Wikipedia, the free encyclopedia

Glasgow Haskell Compiler
Developer: University of Glasgow
Latest release: 6.6 / Oct 11, 2006
OS: Cross-platform
Use: Compiler
License: BSD
Website: GHC home

The Glasgow Haskell Compiler (or GHC) is an open source native code compiler for the functional programming language Haskell.

Contents

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, and a profiler.[1]

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. [2]

GHC's user manual refers to it as "The Glorious Glasgow Haskell Compilation System".[3]

GHC is itself written in Haskell (in a technique known as bootstrapping), but the runtime system for Haskell — an essential part of the compiler — is written in C and C--. Much of GHC is written in the literate programming style.

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.[1]

In its last phase, the front end desugars Haskell into a typed intermediate language known as "Core" (based on System F, extended with let and case expressions). 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.[4]

The final stage of the simplifier transforms Core code into STG (short for "Spineless Tagless G-machine"), a lower-level intermediate language. Like Core, STG is itself a functional language, as well as representing an abstract machine. GHC's back end performs transformations on STG before translating it into C, C--, or native machine code (the traditional "code generation" phase).[5]

GHC complies with the latest language standard, called Haskell 98.[6] It also supports many optional extensions to the Haskell standard: for example, the 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 and Mac OS X.) GHC has also been ported to several different processor architectures.

  1. ^ a b 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). 
  2. ^ The GHC Team. Retrieved on 2007-01-28.
  3. ^ The Glorious Glasgow Haskell Compilation System User's Guide, Version 6.6. Retrieved on 2007-01-28.
  4. ^ Peyton Jones, S. (April 1996). "Compiling Haskell by program transformation: a report from the trenches". Proc. European Symposium on Programming (ESOP). 
  5. ^ 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. 
  6. ^ Haskell 98 Language and Libraries: The Revised Report. Retrieved on 2007-01-28.

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.