2017-09-28 13:08:25 +02:00
2017-12-05 13:35:14 +01:00
2017-12-02 20:58:39 +01:00
2017-09-29 17:22:15 +02:00
2017-12-08 16:11:58 +01:00

AssemblyScript NEXT

Build Status

AssemblyScript is a new compiler targeting WebAssembly while utilizing TypeScript's syntax and node's vibrant ecosystem. Instead of requiring complex toolchains to set up, you can simply npm install it - or run it in a browser.

By compiling a variant of TypeScript to Binaryen IR, the resulting module can be validated, optimized, emitted in WebAssembly text or binary format and converted to asm.js as a polyfill.

The compiler itself is written in "portable AssemblyScript" so it can be compiled to both JavaScript using tsc and, eventually, to WebAssembly using asc.

Development status

This version of the compiler (0.5.0, NEXT) is relatively new and does not yet support some features a TypeScript programmer might expect, e.g., strings, arrays and classes. For now, you can see the compiler tests for an overview of what's supposed to be working already.

Getting started

If you'd like to try it today or even plan to contribute, this is how you do it:

$> git clone https://github.com/AssemblyScript/next.git
$> cd next
$> npm install

Author your module in AssemblyScript (definitions) or portable AssemblyScript (definitions) and run:

$> node bin\asc yourModule.ts

Using the CLI

Syntax:   asc [options] [entryFile ...]

Examples: asc hello.ts
          asc hello.ts -b hello.wasm -t hello.wast -a hello.js
          asc hello.ts -b > hello.wasm

Options:
 -v, --version      Prints the compiler's version.
 -h, --help         Prints this message.
 -O, --optimize     Optimizes the module.
 -c, --validate     Validates the module.
 -o, --outFile      Specifies the output file. Format is determined by file extension.
 -b, --binaryFile   Specifies the binary format output file (.wasm).
 -t, --textFile     Specifies the text format output file (.wast).
 -a, --asmjsFile    Specifies the asm.js format output file (.js).
 --noTreeShaking    Disables tree-shaking.
 --noDebug          Disables assertions.
 --trapMode         Sets the trap mode to use.
                    allow  Allow trapping operations. This is the default.
                    clamp  Replace trapping operations with clamping semantics.
                    js     Replace trapping operations with JS semantics.

Unless a bundle has been built to dist/, asc runs the TypeScript sources on the fly via ts-node. Useful for development.

Building

Building an UMD bundle to dist/assemblyscript.js (does not bundle binaryen.js):

$> npm run build

Running the tests:

$> npm test
Description
No description provided
Readme Apache-2.0 52 MiB
Languages
WebAssembly 74.3%
TypeScript 24.1%
JavaScript 1.6%