Giter Club home page Giter Club logo

kaleidoscope-2's Introduction

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

Stephen Diehl

Haskell LLVM Tutorial

Build Status MIT License

Read Online:

Building with Stack ( Recommended )

Using the LLVM toolchain requires several system libraries:

$ apt-get install llvm-3.5
$ apt-get install libedit-dev

The resulting page and chapter samples can be built using the given Makefile.

$ stack build
$ stack ghc preprocessor.hs -- -o preprocessor 
$ stack exec make

Building with Cabal

$ apt-get install llvm-3.5
$ apt-get install libedit-dev

Install the dependencies:

$ cabal sandbox init

If you just want to compile the examples then configure with the following command. Ensure that llvm-config is on your $PATH.

$ cabal configure

If you want to build the tutorial text locally configure with the following. This will install pandoc from source which will take a while.

$ cabal configure --flags=tutorial

Then install the dependencies:

$ cabal install --only-dependencies

Source Code

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

$ cabal run chapter2
$ cabal run chapter6
$ make chapter2
$ 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:

$ make tutorial.html

A standalone PDF can also be generated with:

$ 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

kaleidoscope-2's People

Contributors

amir avatar arminius avatar djv avatar doersino avatar erdeszt avatar kmarekspartz avatar oregu avatar sdiehl avatar thekafkaf avatar timjb avatar torosfanny avatar wdv4758h avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.