Compiles statically typed ES6 (Flow-flavoured) module into asm.js while preserving ES6 module interface. Still a subset of JavaScript, but much more suitable for hand-writing (so that you don't need to use C/C++ -> Emscripten -> asm.js for maths)
Work in progress.
- ES6
import
and namedexport
- automatic
var
,let
,const
extraction and conversion - automatic function layout
- function parameter annotations
- function return type annotation
- assignment with automatic type conversion
- Flow type cast into asm.js type cast
- automatic asm.js imports for stdlib and foreign references
- automatic program layout
- automatic wrapping into asm.js module with
initialize
for passing ownheap
- bug fixing
- global variable support
- string support (literals are already converted to IDs, need to support operations)
- better asm.js<->normal code communication
- limited object and array support
$ npm install babel-plugin-asm-js
.babelrc
{
"plugins": ["asm-js"]
}
$ babel --plugins asm-js script.js
require("babel-core").transform("code", {
plugins: ["asm-js"]
});