2017-12-15 15:00:19 +01:00
 AssemblyScript NEXT
=================
2017-09-28 13:08:25 +02:00
2017-12-15 15:00:19 +01:00
[](https://travis-ci.org/AssemblyScript/assemblyscript)
2017-12-02 20:58:39 +01:00
2017-12-30 05:11:58 +01:00
**AssemblyScript** compiles strictly typed [TypeScript ](http://www.typescriptlang.org ) to [WebAssembly ](http://webassembly.org ) using [Binaryen ](https://github.com/WebAssembly/binaryen ). Unlike other toolchains, `asc` generates minimal WebAssembly modules while being just an `npm install` away.
2017-12-15 15:00:19 +01:00
2017-12-14 16:50:59 +01:00
Examples
--------
2017-12-07 04:37:14 +01:00
2017-12-11 18:46:11 +01:00
A few early examples to get an idea:
2017-12-25 12:08:51 +01:00
* **[Conway's Game of Life ](./examples/game-of-life )**< br />
Continuously updates the cellular automaton and visualizes its state on a canvas.
* **[i64 polyfill ](./examples/i64-polyfill )**< br />
Exposes WebAssembly's i64 operations to JavaScript using 32-bit integers (low and high bits).
2017-12-30 05:11:58 +01:00
* **[PSON decoder ](./examples/pson )**< br />
A PSON decoder implemented in AssemblyScript.
2018-01-16 05:25:03 +01:00
* **[TLSF memory allocator ](./examples/tlsf )**< br />
2018-02-01 17:35:51 +01:00
An implementation of the TLSF memory allocator in AssemblyScript.
2018-01-18 01:46:41 +01:00
* **[μgc garbage collector ](./examples/ugc )**< br />
2018-01-18 05:56:45 +01:00
A port of μgc to AssemblyScript.
2018-01-16 05:25:03 +01:00
2018-01-05 18:20:57 +01:00
Or browse the [compiler tests ](./tests/compiler ) for a more in-depth overview of what's supported already. One of them is a [showcase ](./tests/compiler/showcase.ts ).
2017-12-11 18:46:11 +01:00
2017-12-05 13:35:14 +01:00
Getting started
---------------
2017-12-25 12:08:51 +01:00
Note that this version of the compiler is relatively new and does not yet support some features a TypeScript programmer might expect, e.g., strings, arrays and classes. It is not on [npm ](https://www.npmjs.com/package/assemblyscript ), yet, but you can already try it out today:
2017-12-05 13:35:14 +01:00
```
2017-12-15 17:23:04 +01:00
$> git clone https://github.com/AssemblyScript/assemblyscript.git
$> cd assemblyscript
2017-12-05 13:35:14 +01:00
$> npm install
2017-12-25 12:08:51 +01:00
$> npm link
2017-12-05 13:35:14 +01:00
```
2017-12-13 04:46:05 +01:00
Author your module using either
2017-12-13 00:11:45 +01:00
* the [assembly definitions ](./std/assembly.d.ts ) ([base config ](./std/assembly.json )) if all you care about is targeting WebAssembly/asm.js or
* the [portable definitions ](./std/portable.d.ts ) ([base config ](./std/portable.json )) if you also want to compile to JavaScript using `tsc`
and run:
2017-12-05 13:35:14 +01:00
```
2017-12-25 12:08:51 +01:00
$> asc yourModule.ts
2017-12-05 13:35:14 +01:00
```
2017-12-25 12:08:51 +01:00
See [the AssemblyScript wiki ](https://github.com/AssemblyScript/assemblyscript/wiki ) for additional documentation.
2017-12-10 21:59:45 +01:00
Building
--------
2017-12-27 02:37:53 +01:00
Building an UMD bundle to `dist/assemblyscript.js` ([binaryen.js ](https://github.com/AssemblyScript/binaryen.js ) remains an external dependency):
2017-12-10 21:59:45 +01:00
```
$> npm run build
```
Running the [tests ](./tests ):
```
$> npm test
```