Created
March 19, 2019 04:46
-
-
Save goofmint/f9a02b149b8b595a0ef13398307404ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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