Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created March 19, 2019 04:46
Show Gist options
  • Save goofmint/f9a02b149b8b595a0ef13398307404ad to your computer and use it in GitHub Desktop.
Save goofmint/f9a02b149b8b595a0ef13398307404ad to your computer and use it in GitHub Desktop.
const {wastInstructions} = require('inline-wast/lib/interpreter');
function add(a, b) {
const fn = wastInstructions`
(i32.const ${a})
(i32.const ${b})
(i32.add)
`;
return fn();
}
console.log(add(3, 1)); // 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment