Skip to content

Instantly share code, notes, and snippets.

@shaunlebron
Created October 11, 2018 12:18
Show Gist options
  • Save shaunlebron/4475edcf89a1a7693fb2a820cbf0682b to your computer and use it in GitHub Desktop.
Save shaunlebron/4475edcf89a1a7693fb2a820cbf0682b to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/nisoget
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://unpkg.com/[email protected]/dist/walt.js"></script>
<script id="jsbin-javascript">
// See https://github.com/ballercat/walt/tree/master/packages/walt-compiler
const walt = Walt;
function walt2wat(source) {
const {prettyPrintNode,compile} = walt;
return prettyPrintNode(compile(source).ast);
}
console.log(walt2wat(`
const x: i32 = 2;
export function echo(): i32 {
const x: i32 = 42;
return x;
}
`));
</script>
<script id="jsbin-source-javascript" type="text/javascript">// See https://github.com/ballercat/walt/tree/master/packages/walt-compiler
const walt = Walt;
function walt2wat(source) {
const {prettyPrintNode,compile} = walt;
return prettyPrintNode(compile(source).ast);
}
console.log(walt2wat(`
const x: i32 = 2;
export function echo(): i32 {
const x: i32 = 42;
return x;
}
`));</script></body>
</html>
// See https://github.com/ballercat/walt/tree/master/packages/walt-compiler
const walt = Walt;
function walt2wat(source) {
const {prettyPrintNode,compile} = walt;
return prettyPrintNode(compile(source).ast);
}
console.log(walt2wat(`
const x: i32 = 2;
export function echo(): i32 {
const x: i32 = 42;
return x;
}
`));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment