タグ

ghcとSTGに関するxefのブックマーク (2)

  • HaskellのSTG言語 - 純粋関数型技術メモ

    この記事では GHC 8.0.1 を用いています. STG言語 STG(Spinless Tagless G-machine)とは,遅延評価で高階関数をサポートする関数型言語のための抽象機械である. STG(Shared Term Graph*1)言語はSTG機械のための言語で,GHCでは Haskellソース → Core言語 → STG言語 → C-- → アセンブラ,LLVM というコンパイル過程で中間言語として現れる. STG言語は,ghcで --ddump-stg オプションをつけてコンパイルすると出力される. Core言語 Core言語は概ねHaskellのサブセットであり,脱糖したHaskellとみることができる.Haskellと異なる点は, 多相関数が引数に明示的に型パラメータをとる(@ a) パターンマッチはcase式でのみ可能で,ネストしたパターンは使えない. 変数はリ

    HaskellのSTG言語 - 純粋関数型技術メモ
  • A weblog of sorts - Announcing simplexhc

    Simplexhc - a STG to LLVM compiler Link to Github repo. I’m trying to understand GHC’s design choices when it comes to compilation. The way GHC currently compiles is to first reduce Haskell to a Core language, which is a minimal subset of Haskell, in some sense. Next, it compiles Core to STG, which is an “abstract machine” that is Haskell’s view of what the hardware should be like. STG stands for

    xef
    xef 2017/06/30
  • 1