-
-
Save Yardanico/1717feb2aee4bd9298191be6255f0673 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
import ../wasmrt, mathexpr, strutils | |
let e = newEvaluator() | |
e.addVar("a", 5.5) | |
echo e.eval("2 + 2 * 2 - 4 + a - 2.5").int |
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
<html> | |
<head> | |
<title>Webasm test nim</title> | |
</head> | |
<body> | |
<script> | |
function runNimWasm(w){for(i of WebAssembly.Module.exports(w)){n=i.name;if(n[0]==';'){new Function('m',n)(w);break}}} | |
fetch("test.wasm").then(response => | |
response.arrayBuffer() | |
).then(bytes => | |
WebAssembly.compile(bytes) | |
).then(mod => | |
runNimWasm(mod) | |
); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment