项目作者: sdiehl

项目描述 :
Haskell LLVM JIT Compiler Tutorial
高级语言: Haskell
项目地址: git://github.com/sdiehl/kaleidoscope.git
创建时间: 2013-12-28T05:12:52Z
项目社区:https://github.com/sdiehl/kaleidoscope

开源协议:Other

下载







A short guide to building a tiny programming language in Haskell with LLVM.


Stephen Diehl

Haskell LLVM Tutorial

Build Status
MIT License

Read Online:

Setup

You will need GHC 7.8 or newer as well as LLVM 4.0. For information on installing LLVM 4.0 (not 3.9 or earlier)
on your platform of choice, take a look at the
instructions posted by the llvm-hs maintainers.

With Haskell and LLVM in place, you can use either Stack or Cabal to install the necessary Haskell
bindings and compile the source code from each chapter.

  1. $ stack build

You can then run the source code from each chapter (starting with chapter 2) as follows:

  1. $ stack exec chapter2

Building with Cabal

Ensure that llvm-config is on your $PATH, then run:

  1. $ cabal sandbox init
  2. $ cabal configure
  3. $ cabal install --only-dependencies

Then to run the source code from each chapter (e.g. chapter 2):

  1. $ cabal run chapter2

Building with make

The source code for the example compiler of each chapter is included in the /src folder. With the dependencies
installed globally, these can be built using the Makefile at the root level:

  1. $ make chapter2
  2. $ make chapter6

A smaller version of the code without the parser frontend can be found in the
llvm-tutorial-standalone
repository. The LLVM code generation technique is identical.

Editing

This is an open source project, patches and corrections always welcome.

To generate the HTML page:

  1. $ make tutorial.html

A standalone PDF can also be generated with:

  1. $ make tutorial.pdf

License

Text is adapted from the LLVM tutorial and is subsequently licensed under the
LLVM license.

The Haskell source files are released under the MIT license. Copyright (c)
2013-2016, Stephen Diehl