Wednesday, June 05, 2019

AssemblyScript: WebAssembly + TypeScript

WebAssembly.org

mbasso/awesome-wasm: 😎 Curated list of awesome things regarding WebAssembly (wasm) ecosystem @GitHub
Collection of awesome things regarding WebAssembly (wasm) ecosystem.

WebAssembly. Neither Web Nor Assembly, All Revolutionary @InfoQ

WebAssembly: Neither Web Nor Assembly, But Revolutionary PDF slides

WebAssembly is a stack machinea data structure with two operations: push and pop
stack machine: instructions on a stack
instead of AST, SSA, or register machine

1+2 => 1, 2, +

i32.const 1
i32.const 2
i32.add

int factorial(int n) {
  if (n == 0) { return 1; }
  else { return n * factorial(n - 1); }
}


(func $factorial (param $n i32) (result i32)
  get_local $n
  i32.const 0
  i32.eq
  if $if0
  i32.const 1
  return
  end $if0
  get_local $n
  i32.const 1
  i32.sub
  call $factorial
  get_local $n
  i32.mul
)



AssemblyScript

AssemblyScript/assemblyscript: Definitely not a TypeScript to WebAssembly compiler 🚀@GitHub

"AssemblyScript compiles strictly typed TypeScript (basically JavaScript with types) to WebAssembly using Binaryen. It generates lean and mean WebAssembly modules while being just an npm install away.

Try it out in WebAssembly Studio!"




No comments: