pisces
所属分类:编译器/解释器
开发工具:Haskell
文件大小:24KB
下载次数:0
上传日期:2018-02-17 12:53:46
上 传 者:
sh-1993
说明: 一种用Haskell实现的简单编程语言,以LLVMIR为目标。
(A simple programming language implemented in Haskell with LLVM IR as target.)
文件列表:
.travis.yml (865, 2018-01-05)
ChangeLog.md (46, 2018-01-05)
LICENSE (35149, 2018-01-05)
Setup.hs (46, 2018-01-05)
app (0, 2018-01-05)
app\Main.hs (1042, 2018-01-05)
doc (0, 2018-01-05)
doc\language.md (1690, 2018-01-05)
package.yaml (1010, 2018-01-05)
sample (0, 2018-01-05)
sample\collatz.pscs (474, 2018-01-05)
src (0, 2018-01-05)
src\Codegen.hs (4834, 2018-01-05)
src\Lang.hs (1831, 2018-01-05)
src\Lexer.hs (1997, 2018-01-05)
src\Parser.hs (4120, 2018-01-05)
stack.yaml (77, 2018-01-05)
test (0, 2018-01-05)
test\CodegenSpec.hs (3325, 2018-01-05)
test\ParserSpec.hs (2819, 2018-01-05)
test\Spec.hs (45, 2018-01-05)
# pisces <>< [![Build Status](https://travis-ci.org/FPar/pisces.svg?branch=master)](https://travis-ci.org/FPar/pisces)
## What is pisces?
I wanted to learn how to write a compiler in Haskell using parser combinators.
So pisces is a very basic programming language with the syntax inspired a little
bit by the Rust programming languge. The compiler provided in this repository
targets LLVM and emits LLVM assembly language.
A simple pisces program looks like this (extern functions calls are not yet
implemented, so no "Hello World" ):
```rust
fn add(a: i***, b: i***) -> i***
{
var c: i*** = a + b;
return c;
}
fn main () -> i***
{
return add(4, 5);
}
```
## Usage
In order to build it you need LLVM 5.0. From here it's just `stack build`.
Compile and run a program:
```
stack exec pscsc main.pscs
llvm-as a.ll
lli a.bc
```
To build a native executable:
```
...
llc -filetype=obj a.bc
clang a.o
./a.out
```
## Documentation
* [Pisces language reference](/doc/language.md)
* [API](https://fpar.github.io/pisces/)
近期下载者:
相关文件:
收藏者: