The LHC Haskell Compiler aims at compiling Haskell2010 to LLVM IR using theHaskellSuite of libraries.
LHC is built by stack:
stack setup
stack build
stack exec lhc
Installing the lhc-prim library is required before the example programs can becompiled.
stack install cabal-install
stack exec -- cabal update
(cd packages/lhc-prim/ && stack exec -- cabal install --haskell-suite -w `stack exec -- which lhc`)
After lhc-prim has been installed, all the programs in examples/
will becompilable:
stack exec -- lhc build examples/HelloWorld.hs
lli examples/HelloWorld.ll
You can run lhc
with the --keep-intermediate-files
flag to inspect thevarious stages of the transformation from bedrock to llvm.
stack exec -- lhc build --verbose --keep-intermediate-files examples/HelloWorld.hs
Running the test suite is done via stack:
stack test && cat .stack-work/logs/lhc-*-test.log
LHC is comprised of separate libraries which are developed independenly and arein various states of completion.
Haskell-scope implements name resolution for a sizable subset of Haskell2010 butit's far from complete. So far it hasn't proved a bottleneck.
Haskell-tc implements type-checking and type-inference for a small subset ofHaskell2010. Only the constructs used in the example programs are supported.
Haskell-crux is responsible for desugaring and, like haskell-tc, has only beendefined for exactly those language constructs which are currently used by theexample programs.
The base is extremely minimal and functions are implemented on a by-need basis.
None. Will eventually write a minimal implementation in either Haskell or C.
Not implemented yet but the RTS has been designed with exceptions in mind.
LHC has a simple but accurate semispace garbage collector.
Not supported. Will eventually use libuv.
Not supported. Will eventually use libicu.
┌──────────────────┐
│ Parsing │
│ haskell-src-exts │
└────────┬─────────┘
┌────────┴────────┐
│ Name resolution │
│ haskell-scope │
└────────┬────────┘
┌───────┴───────┐
│ Type-checking │
│ haskell-tc │
└───────┬───────┘
┌──────┴───────┐
│ Desugaring │
│ haskell-crux │
└──────┬───────┘
┌────────┴────────┐
│ Optimizing Core │
│ LHC │
└────────┬────────┘
┌────┴────┐
│ Bedrock │
│ bedrock │
└────┬────┘
┌───────┴───────┐
│ Generate LLVM │
│ bedrock │
└───────────────┘
lhc 关闭 大型强子对撞机(LHC)是一种粒子加速器,旨在彻底改变我们对宇宙的理解。 全球LHC计算网格 (LCG)项目为将使用LHC的整个高能物理社区提供数据存储和分析基础结构。 LCG于2003年推出,旨在将全球数百个数据中心中的数千台计算机集成到全球计算资源中,以存储和分析LHC将收集的大量数据。 据估计,大型强子对撞机每年产生大约15 PB(1500万千兆字节)的数据。 这相当于每年填满