Giter Site home page Giter Site logo

mattaudesse / olifant Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jaseemabid/olifant

0.0 2.0 0.0 234 KB

A simple programming language targeting LLVM

License: BSD 3-Clause "New" or "Revised" License

Dockerfile 3.00% Makefile 3.56% Haskell 89.97% C 1.46% LLVM 2.01%

olifant's Introduction

Olifant Build Status Docker Repository on Quay

A simple functional language targeting LLVM, WIP

Project is setup with stack

$ git pull https://github.com/jaseemabid/Olifant && cd Olifant
$ stack setup && stack build

See the blog post Lessons learned building a toy compiler for a detailed introduction to the project.

The test coverage isn't great, but has a bunch of good code samples. They run pretty fast too.

$ stack test

The README maybe sparse, but there is a lot of inline documentation in the code; which can be read with Haddock.

$ stack haddock --no-haddock-deps --open

Olifant programs can be compiled to native binaries and executed in one step.

$ stack exec olifant <<< 'sum 4 5'
$ 9

The intermediary forms can be exported with additional flags. For example, the output of the parser can be viewed with -p.

$ stack exec olifant -- -p <<< 'sum 4 5'
[ App (Ref
       {rname = "sum", ri = 0, rty = TInt :> (TInt :> TInt), rscope = Extern})
      [Lit (Number 4), Lit (Number 5)]
]

Similarly, Core is exported with -c and the intermediary LLVM IR is exported with -l

$ olifant -l examples/vars.ol
$ file vars.ll
vars.ll: ASCII text

The compiler accepts programs from stdin or takes a file as argument.

Docker images are automatically built by quay.io as well as by Travis CI as part of automated testing. Any of the following work.

$ docker pull olifant/olifant

I would LOVE any code contributions. There is a milestone to track priority bugs and features if you are looking for some inspiration.

olifant's People

Contributors

jaseemabid avatar

Watchers

 avatar  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.