Olifant

所属分类:编译器/解释器
开发工具:Haskell
文件大小:34KB
下载次数:0
上传日期:2018-10-15 23:29:03
上 传 者sh-1993
说明:  一种面向LLVM的简单编程语言
(A simple programming language targeting LLVM)

文件列表:
.dir-locals.el (203, 2018-10-16)
.dockerignore (107, 2018-10-16)
.hindent.yaml (60, 2018-10-16)
.stylish-haskell.yaml (6439, 2018-10-16)
.travis.yml (251, 2018-10-16)
.watsonrc (196, 2018-10-16)
Dockerfile (1762, 2018-10-16)
LICENSE (1518, 2018-10-16)
Makefile (1337, 2018-10-16)
Olifant.cabal (2599, 2018-10-16)
Setup.hs (46, 2018-10-16)
docs (0, 2018-10-16)
docs\Notes.org (1524, 2018-10-16)
docs\Types.org (3903, 2018-10-16)
examples (0, 2018-10-16)
examples\sum.ol (57, 2018-10-16)
examples\vars.ol (20, 2018-10-16)
exe (0, 2018-10-16)
exe\CLI.hs (3369, 2018-10-16)
llvm-examples (0, 2018-10-16)
llvm-examples\Makefile (410, 2018-10-16)
llvm-examples\hello.c (240, 2018-10-16)
runtime (0, 2018-10-16)
runtime\olifant.c (477, 2018-10-16)
src (0, 2018-10-16)
src\Olifant.hs (21, 2018-10-16)
src\Olifant (0, 2018-10-16)
src\Olifant\Compiler.hs (7501, 2018-10-16)
src\Olifant\Core.hs (5817, 2018-10-16)
src\Olifant\Gen.hs (10382, 2018-10-16)
src\Olifant\Parser.hs (6902, 2018-10-16)
stack.yaml (229, 2018-10-16)
test (0, 2018-10-16)
test\Main.hs (323, 2018-10-16)
... ...

# Olifant [![Build Status](https://travis-ci.org/jaseemabid/Olifant.svg?branch=master)](https://travis-ci.org/jaseemabid/Olifant) [![Docker Repository on Quay](https://quay.io/repository/jaseemabid/olifant/status "Docker Repository on Quay")](https://quay.io/repository/jaseemabid/olifant) A simple functional language targeting LLVM, __WIP__ ’ Project is setup with [stack][stack] $ git pull https://github.com/jaseemabid/Olifant && cd Olifant $ stack setup && stack build See the blog post [Lessons learned building a toy compiler][blog] 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 This is NOT an interpreter, a machine native binary is produced and executed in one step . $ file /tmp/cmd.exe $ /tmp/cmd.exe: Mach-O ***-bit executable x86_*** There are some samples programs in the examples directory - these are real programs used by the test runner so if the tests are …, these are guaranteed to work. 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' ```haskell [ 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`. The compiler accepts programs from stdin or takes a file as argument. $ olifant -l examples/vars.ol $ file vars.ll vars.ll: ASCII text Docker images are automatically built by quay.io as well as by Travis CI as part of automated testing. If you have trouble building the dependencies/libraries locally, try the container. $ make container $ docker run -it olifant/olifant I would *LOVE* any code contributions. There is a [milestone][milestone] to track priority bugs and features if you are looking for some inspiration. [blog]: https://jaseemabid.github.io/2017/07/04/compiler.html [stack]: https://haskellstack.org [milestone]: https://github.com/jaseemabid/Olifant/milestone/2

近期下载者

相关文件


收藏者