diff --git a/README.md b/README.md index 690586a9..3681b2fd 100644 --- a/README.md +++ b/README.md @@ -9,17 +9,17 @@ By compiling syntactially (not necessarily semantically) valid TypeScript to [Bi The compiler itself utilizes "portable definitions" so it can be compiled to both JavaScript using `tsc` and, eventually, to WebAssembly using `asc`. -Development status ------------------- +Note, though, that 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. -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](https://github.com/AssemblyScript/next/tree/master/tests/compiler) for an overview of what's supposed to be working already. +See [the AssemblyScript wiki](https://github.com/AssemblyScript/assemblyscript/wiki) for additional information and documentation. + +Examples +-------- A few early examples to get an idea: -* **Conway's Game of Life** as seen on [dcode.io](http://dcode.io)
- [source](./examples/game-of-life/assembly/game-of-life.ts) - [wast](./examples/game-of-life/assembly/game-of-life.optimized.wast) - [html](./examples/game-of-life/game-of-life.html) -* **i64 polyfill** using 32-bit integers
- [source](./examples/i64-polyfill/assembly/i64.ts) - [wast](./examples/i64-polyfill/assembly/i64.optimized.wast) - [js](./examples/i64-polyfill/index.js) +* **[Conway's Game of Life](./examples/game-of-life)** as seen on dcode.io
+* **[i64 polyfill](./examples/i64-polyfill)** using 32-bit integers
Getting started --------------- @@ -43,35 +43,6 @@ 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 (portable) TypeScript sources on the fly via [ts-node](https://www.npmjs.com/package/ts-node). Useful for development. - Building -------- diff --git a/examples/game-of-life/README.md b/examples/game-of-life/README.md index ff681b4b..5df600ce 100644 --- a/examples/game-of-life/README.md +++ b/examples/game-of-life/README.md @@ -1,7 +1,7 @@ Conway's Game of Life ===================== -An AssemblyScript example. +An [AssemblyScript](http://assemblyscript.org) example. Continuously updates the cellular automaton and visualizes its state on a canvas. Instructions ------------ diff --git a/examples/i64-polyfill/README.md b/examples/i64-polyfill/README.md index 3bad8213..1cf9e56c 100644 --- a/examples/i64-polyfill/README.md +++ b/examples/i64-polyfill/README.md @@ -1,7 +1,7 @@ i64 polyfill ============ -An AssemblyScript example. +An [AssemblyScript](http://assemblyscript.org) example. Exposes i64 operations to JS using 32-bit integers (low and high bits). Instructions ------------ diff --git a/examples/i64-polyfill/package.json b/examples/i64-polyfill/package.json index 5c1af423..1edd5a21 100644 --- a/examples/i64-polyfill/package.json +++ b/examples/i64-polyfill/package.json @@ -5,6 +5,6 @@ "scripts": { "build": "npm run build:untouched && npm run build:optimized", "build:untouched": "asc assembly/i64.ts -t i64.untouched.wast -b i64.untouched.wasm --validate", - "build:optimized": "asc -O assembly/i64.ts -b i64.optimized.wasm -t i64.optimized.wast --validdate" + "build:optimized": "asc -O assembly/i64.ts -b i64.optimized.wasm -t i64.optimized.wast --validate" } } diff --git a/std/assembly.d.ts b/std/assembly.d.ts index 1e4cd97e..bfbeba9b 100644 --- a/std/assembly.d.ts +++ b/std/assembly.d.ts @@ -63,15 +63,15 @@ declare function select(ifTrue: T, ifFalse: T, condition: bool): T; declare function sqrt(value: T): T; /** Rounds to the nearest integer towards zero of a 32-bit or 64-bit float. */ declare function trunc(value: T): T; -/** Loads a value of the specified type from memory. */ +/** Loads a value of the specified type from memory. Equivalent to dereferncing a pointer in other languages. */ declare function load(offset: usize): T; -/** Stores a value of the specified type to memory. */ +/** Stores a value of the specified type to memory. Equivalent to dereferencing a pointer in other languages when assigning a value. */ declare function store(offset: usize, value: T): void; /** Returns the current memory size in units of pages. One page is 64kb. */ declare function current_memory(): i32; /** Grows linear memory by a given unsigned delta of pages. One page is 64kb. Returns the previous memory size in units of pages or `-1` on failure. */ declare function grow_memory(value: i32): i32; -/** Emits an unreachable operation that results in a runtime error when executed. */ +/** Emits an unreachable operation that results in a runtime error when executed. Both a statement and an expression of any type. */ declare function unreachable(): any; // sic /** NaN (not a number) as a 32-bit or 64-bit float depending on context. */ @@ -84,9 +84,9 @@ declare const HEAP_START: usize; declare function sizeof(): usize; /** Changes the type of a value to another one. Useful for casting class instances to their pointer values and vice-versa. */ declare function changetype(value: T1): T2; -/** Tests if a 32-bit or 64-bit float is NaN. */ +/** Tests if a 32-bit or 64-bit float is `NaN`. */ declare function isNaN(value: T): bool; -/** Tests if a 32-bit or 64-bit float is finite, that is not NaN or +/-Infinity. */ +/** Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`. */ declare function isFinite(value: T): bool; /** Traps if the specified value evaluates to `false`. */ declare function assert(isTrue: bool, message?: string): void;