Skip to content
dcodeIO edited this page Mar 2, 2018 · 18 revisions

What exactly is AssemblyScript?

AssemblyScript subsets TypeScript's syntax and semantics so programs written using this subset can be compiled to WebAssembly ahead of time (see: Limitations). It's not really a language on its own, though it provides several new WebAssembly-specific types and built-ins, but rather a compiler-variant for the same thing that compiles to Binaryen IR instead.

As a result, it's both possible to write portable code that compiles to WebAssembly using asc and JavaScript using tsc, as well as close-to-the-metal WebAssembly. Yet, the compiler doesn't force a programmer to do either of this, so mixing things up is perfectly possible as well.

Direct integration with Binaryen provides a heap of advantages as well. Generated code can be properly validated for example, optimized for speed and/or size depending on a project's requirements, emitted in various output formats including source map generation, and all this without the overhead of piping outputs through multiple tools.

At this point in time, some things work pretty well already, while others are still in the works.

 

Clone this wiki locally