Glasgow Haskell Compiler: Porovnání verzí

Z Wikipedie, otevřené encyklopedie
Smazaný obsah Přidaný obsah
započetí překladu z {{Překlad|en|Glasgow Haskell Compiler}}
 
m oprava odkazu en, +oldid
Řádek 55: Řádek 55:


[[ca:GHC]]
[[ca:GHC]]
[[ca:Glasgow Haskell Compiler]]
[[en:Glasgow Haskell Compiler]]
[[es:Glasgow Haskell Compiler]]
[[es:Glasgow Haskell Compiler]]
[[fr:Glasgow Haskell Compiler]]
[[fr:Glasgow Haskell Compiler]]
Řádek 62: Řádek 62:
[[ru:Glasgow Haskell Compiler]]
[[ru:Glasgow Haskell Compiler]]


{{Překlad|en|Glasgow Haskell Compiler}}
{{Překlad
| jazyk = en
| článek = Glasgow Haskell Compiler
| revize = 260109988
}}

Verze z 31. 12. 2008, 13:11

Šablona:Infobox Software

The Glorious Glasgow Haskell Compilation System, známý pod jmény Glasgow Haskell Compiler či GHC, je open sourcovýkompilátor strojového kódu pro funkcionální programovací jazyk Haskell. Hlavními vývojáři jsou Simon Peyton Jones a Simon Marlow.

Historie

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]

Architektura

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). 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 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. STG also corresponds to 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).

Jazyk

GHC complies with the latest language standard, called Haskell 98.[3] It also supports many optional extensions to the Haskell standard: for example, the STM library, which allows for Composable Memory Transactions.

Přenositelnost

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.


Externí odkazy

V tomto článku byl použit překlad textu z článku Glasgow Haskell Compiler na anglické Wikipedii.

  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 [online]. [cit. 2007-01-28]. Dostupné online. 
  3. Haskell 98 Language and Libraries: The Revised Report [online]. [cit. 2007-01-28]. Dostupné online.