Efficient and portable bytecode
Possible compilation target
Stack machine language
00 61 73 6d 01 00 00 00 01 00 01 60 01 7c 01 7c 06 03 00 01 00 02 07 00 01 03 66 61 63 00 00 07 0a 00 01 00 00 20 00 44 00 00 00 00 00 00 f0 3f 63 04 7c 44 00 00 00 00 00 00 f0 3f 05 20 00 20 00 44 00 00 00 00 00 00 f0 3f a1 10 00 a2 0b 0b 2c 2e 00 00 04 6e 61 6d 65 01 00 01 00 03 66 61 63 06 02 00 01 00 01 00 00 05 14
(module
(func $fac (param f64) (result f64)
get_local 0
f64.const 1
f64.lt
if (result f64)
f64.const 1
else
get_local 0
get_local 0
f64.const 1
f64.sub
call $fac
f64.mul
end)
(export "fac" (func $fac)))
const instance = new WebAssembly.Instance(wasm, {});
for (let i = 1; i <= 15; i++) {
console.log(instance.exports.fac(i));
}
#![feature(proc_macro, wasm_custom_section, wasm_import_module)]
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern {
fn alert(s: &str);
}
#[wasm_bindgen]
pub fn greet(name: &str) {
alert(&format!("Hello, {}!", name));
}
import {greet} from './greet.rs';
greet('World');
7 full integrations
15 almost there
11 started