1
1
mirror of https://github.com/tweag/asterius.git synced 2024-11-10 14:52:44 +03:00
asterius/README.md

44 lines
2.4 KiB
Markdown
Raw Normal View History

# Asterius: A Haskell to WebAssembly compiler
2017-11-20 17:00:14 +03:00
Switch copyright info and point to Tweag I/O (+37 squashed commit) Squashed commit: [d4cd9e9] Update binaryen to WebAssembly/binaryen@01098f1288d37058b5fbac50468a1b07408d6dec [a28ed78] Update binaryen to WebAssembly/binaryen@de999c4673688e1b6f29a9a3023e1295fca33446 [c9f2f9f] Update binaryen to WebAssembly/binaryen@d9692277357ba6fd67a7e25ce16934209d049033 [96744b7] Update binaryen to WebAssembly/binaryen@07f6dfbf0d89d4c07106c0519711dc132f09fab2 [74ff4a6] Update binaryen to WebAssembly/binaryen@5578bb58402fde2bb2c932bfa08ab71045854a41 [653c77b] Update boot libs to ghc/ghc@a032ff77210736df45cf49820c882f40dc10230e [56f8fef] Disable unregisterised build for now; use associated types for relocatable Expression [c2f4b0b] Begin prototyping on a relocatable Expression type [0f58e45] Add recent revisions of HscMain to Unexported module [c40b177] Restore orphan module for now, fixing previous build [719a3a5] Move orphan instances of cereal to use site; implement ValueType/FunctionType [9fc9347] Implement helper functions for invoking raw bindings [6a73c49] Update boot libs to ghc/ghc@043466b9aac403553e2aaf8054c064016f963f80 [76649a4] Factor-out higher-level wasm stuff to another package [c77ed74] Do not build binaryen binaries [d513af5] Update binaryen to WebAssembly/binaryen@27000a9bfa616133c9368214386fd0416f398dfe [614ed53] Stop tracing cereal-utils.cabal [3246b85] Get rid of DeriveAnyClass to remove a bunch of ghc warnings [be8628c] Use cereal for custom serialization [1ccda7f] Remove deprecated interface from hbinaryen; fix build by disabling compact region [f4745d3] Get rid of head.hackage [af5d5bb] Update binaryen to WebAssembly/binaryen@85ae8cc6ffeffa65ff30d17649a0d8589dab2b00 [7aeff32] Update binaryen to WebAssembly/binaryen@e0f86a24bda5612fb798524df23b6071d2dccc14 [191d25d] Run autoreconf -i for ghc-prim [555ce02] Enable autoconf for ghc-prim [b717575] Update boot libs to ghc/ghc@8529fbba309cd692bbbb0386321515d05a6ed256 [407f68d] Add DEPRECATED pragmas to bindings of deprecated functions in binaryen-c.h [c158d54] Re-implement the system-binaryen flag for hbinaryen [25a3f71] Prep for implementing a more Haskellish IR in hbinaryen [4f68a79] Fix test config in circleci config [174805c] Fix circleci cache paths for last commit [f4b03ba] Factor out the hbinaryen package, in case it's useful to other Haskellers working with wasm [a7dd7a1] Invalidate gen2 cache on circleci [de7b151] Include rts in the boot package db [acb87ff] Update binaryen to WebAssembly/binaryen@8ddbac2c642e9fe0809afadbc28abe7c5f668674 [c794c90] Update boot libs to ghc/ghc@c9a88db3ac4f1c3e97e3492ebe076f2df6463540 [0a4528e] Update binaryen to WebAssembly/binaryen@e7f2213265816dbb051ff34867c69fab85d0a861 (+197 squashed commit)
2017-11-20 17:15:25 +03:00
[![CircleCI](https://circleci.com/gh/tweag/asterius/tree/master.svg?style=shield)](https://circleci.com/gh/tweag/asterius/tree/master)
2018-05-21 22:57:52 +03:00
[![AppVeyor](https://ci.appveyor.com/api/projects/status/github/tweag/asterius?branch=master&svg=true)](https://ci.appveyor.com/project/GHCAppveyor/asterius?branch=master)
Switch copyright info and point to Tweag I/O (+37 squashed commit) Squashed commit: [d4cd9e9] Update binaryen to WebAssembly/binaryen@01098f1288d37058b5fbac50468a1b07408d6dec [a28ed78] Update binaryen to WebAssembly/binaryen@de999c4673688e1b6f29a9a3023e1295fca33446 [c9f2f9f] Update binaryen to WebAssembly/binaryen@d9692277357ba6fd67a7e25ce16934209d049033 [96744b7] Update binaryen to WebAssembly/binaryen@07f6dfbf0d89d4c07106c0519711dc132f09fab2 [74ff4a6] Update binaryen to WebAssembly/binaryen@5578bb58402fde2bb2c932bfa08ab71045854a41 [653c77b] Update boot libs to ghc/ghc@a032ff77210736df45cf49820c882f40dc10230e [56f8fef] Disable unregisterised build for now; use associated types for relocatable Expression [c2f4b0b] Begin prototyping on a relocatable Expression type [0f58e45] Add recent revisions of HscMain to Unexported module [c40b177] Restore orphan module for now, fixing previous build [719a3a5] Move orphan instances of cereal to use site; implement ValueType/FunctionType [9fc9347] Implement helper functions for invoking raw bindings [6a73c49] Update boot libs to ghc/ghc@043466b9aac403553e2aaf8054c064016f963f80 [76649a4] Factor-out higher-level wasm stuff to another package [c77ed74] Do not build binaryen binaries [d513af5] Update binaryen to WebAssembly/binaryen@27000a9bfa616133c9368214386fd0416f398dfe [614ed53] Stop tracing cereal-utils.cabal [3246b85] Get rid of DeriveAnyClass to remove a bunch of ghc warnings [be8628c] Use cereal for custom serialization [1ccda7f] Remove deprecated interface from hbinaryen; fix build by disabling compact region [f4745d3] Get rid of head.hackage [af5d5bb] Update binaryen to WebAssembly/binaryen@85ae8cc6ffeffa65ff30d17649a0d8589dab2b00 [7aeff32] Update binaryen to WebAssembly/binaryen@e0f86a24bda5612fb798524df23b6071d2dccc14 [191d25d] Run autoreconf -i for ghc-prim [555ce02] Enable autoconf for ghc-prim [b717575] Update boot libs to ghc/ghc@8529fbba309cd692bbbb0386321515d05a6ed256 [407f68d] Add DEPRECATED pragmas to bindings of deprecated functions in binaryen-c.h [c158d54] Re-implement the system-binaryen flag for hbinaryen [25a3f71] Prep for implementing a more Haskellish IR in hbinaryen [4f68a79] Fix test config in circleci config [174805c] Fix circleci cache paths for last commit [f4b03ba] Factor out the hbinaryen package, in case it's useful to other Haskellers working with wasm [a7dd7a1] Invalidate gen2 cache on circleci [de7b151] Include rts in the boot package db [acb87ff] Update binaryen to WebAssembly/binaryen@8ddbac2c642e9fe0809afadbc28abe7c5f668674 [c794c90] Update boot libs to ghc/ghc@c9a88db3ac4f1c3e97e3492ebe076f2df6463540 [0a4528e] Update binaryen to WebAssembly/binaryen@e7f2213265816dbb051ff34867c69fab85d0a861 (+197 squashed commit)
2017-11-20 17:15:25 +03:00
A Haskell to WebAssembly compiler. Project status: **alpha**, in active development, some simple examples already work.
Switch copyright info and point to Tweag I/O (+37 squashed commit) Squashed commit: [d4cd9e9] Update binaryen to WebAssembly/binaryen@01098f1288d37058b5fbac50468a1b07408d6dec [a28ed78] Update binaryen to WebAssembly/binaryen@de999c4673688e1b6f29a9a3023e1295fca33446 [c9f2f9f] Update binaryen to WebAssembly/binaryen@d9692277357ba6fd67a7e25ce16934209d049033 [96744b7] Update binaryen to WebAssembly/binaryen@07f6dfbf0d89d4c07106c0519711dc132f09fab2 [74ff4a6] Update binaryen to WebAssembly/binaryen@5578bb58402fde2bb2c932bfa08ab71045854a41 [653c77b] Update boot libs to ghc/ghc@a032ff77210736df45cf49820c882f40dc10230e [56f8fef] Disable unregisterised build for now; use associated types for relocatable Expression [c2f4b0b] Begin prototyping on a relocatable Expression type [0f58e45] Add recent revisions of HscMain to Unexported module [c40b177] Restore orphan module for now, fixing previous build [719a3a5] Move orphan instances of cereal to use site; implement ValueType/FunctionType [9fc9347] Implement helper functions for invoking raw bindings [6a73c49] Update boot libs to ghc/ghc@043466b9aac403553e2aaf8054c064016f963f80 [76649a4] Factor-out higher-level wasm stuff to another package [c77ed74] Do not build binaryen binaries [d513af5] Update binaryen to WebAssembly/binaryen@27000a9bfa616133c9368214386fd0416f398dfe [614ed53] Stop tracing cereal-utils.cabal [3246b85] Get rid of DeriveAnyClass to remove a bunch of ghc warnings [be8628c] Use cereal for custom serialization [1ccda7f] Remove deprecated interface from hbinaryen; fix build by disabling compact region [f4745d3] Get rid of head.hackage [af5d5bb] Update binaryen to WebAssembly/binaryen@85ae8cc6ffeffa65ff30d17649a0d8589dab2b00 [7aeff32] Update binaryen to WebAssembly/binaryen@e0f86a24bda5612fb798524df23b6071d2dccc14 [191d25d] Run autoreconf -i for ghc-prim [555ce02] Enable autoconf for ghc-prim [b717575] Update boot libs to ghc/ghc@8529fbba309cd692bbbb0386321515d05a6ed256 [407f68d] Add DEPRECATED pragmas to bindings of deprecated functions in binaryen-c.h [c158d54] Re-implement the system-binaryen flag for hbinaryen [25a3f71] Prep for implementing a more Haskellish IR in hbinaryen [4f68a79] Fix test config in circleci config [174805c] Fix circleci cache paths for last commit [f4b03ba] Factor out the hbinaryen package, in case it's useful to other Haskellers working with wasm [a7dd7a1] Invalidate gen2 cache on circleci [de7b151] Include rts in the boot package db [acb87ff] Update binaryen to WebAssembly/binaryen@8ddbac2c642e9fe0809afadbc28abe7c5f668674 [c794c90] Update boot libs to ghc/ghc@c9a88db3ac4f1c3e97e3492ebe076f2df6463540 [0a4528e] Update binaryen to WebAssembly/binaryen@e7f2213265816dbb051ff34867c69fab85d0a861 (+197 squashed commit)
2017-11-20 17:15:25 +03:00
2018-04-05 10:25:24 +03:00
See the [documentation](https://tweag.github.io/asterius) for further instructions.
## Quick start
We provide pre-built Docker images. Put the input `.hs` program in a directory and map the directory to a Docker volume:
```
terrorjack@ubuntu:~$ docker run -it -v ~/mirror:/mirror terrorjack/asterius
root@76bcb511663d:~# cd /mirror
root@76bcb511663d:/mirror# ahc-link --help
...
```
See the help text of `ahc-link` for further instructions.
What works currently:
* All GHC language features except Template Haskell.
* Non-IO parts in `ghc-prim`/`integer-simple`/`base`/`array`/`deepseq`/`containers`/`transformers`/`mtl`/`pretty`. IO is achieved via rts primitives like `print_i64` or JavaScript FFI.
* Importing JavaScript expressions via the `foreign import javascript` syntax. First-class `JSRef` type in Haskell land.
* Calling Haskell functions from JavaScript via the `foreign export javascript` syntax. Haskell closures can be passed between Haskell/JavaScript boundary via `StablePtr`.
* Invoking RTS API on the JavaScript side to manipulate Haskell closures and trigger evaluation.
* A linker which performs aggressive dead-code elimination, producing as small WebAssembly binary as possible.
* A debugger which outputs memory loads/stores and control flow transfers.
* Complete `binaryen` raw bindings, plus a monadic EDSL to construct WebAssembly code directly in Haskell.
* Besides WebAssembly MVP & the experimental BigInt support, no special requirements on the underlying JavaScript engine.
Better check the [`fib`](asterius/test/fib/fib.hs), [`jsffi`](asterius/test/jsffi/jsffi.hs), [`array`](asterius/test/array/array.hs) and [`rtsapi`](asterius/test/rtsapi.hs) test suites first to get some idea on current capabilities of `asterius`.
## Sponsors
2018-05-28 12:22:06 +03:00
[<img src="https://www.tweag.io/img/tweag-med.png" height="65">](https://tweag.io)
2018-04-05 10:25:24 +03:00
Asterius is maintained by [Tweag I/O](https://tweag.io/).
2018-04-05 10:25:24 +03:00
Have questions? Need help? Tweet at [@tweagio](https://twitter.com/tweagio).