From 4970fdc51f8c83dcd38bbdd25606fe030c0c26d2 Mon Sep 17 00:00:00 2001 From: Xe Date: Sat, 31 Dec 2022 14:43:42 -0500 Subject: nice Signed-off-by: Xe --- cmd/hlang/http.go | 11 ++++------- cmd/hlang/nguh/compile.go | 1 + 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/hlang/http.go b/cmd/hlang/http.go index d4b9aba..4a7f9df 100644 --- a/cmd/hlang/http.go +++ b/cmd/hlang/http.go @@ -298,9 +298,6 @@ const faqTemplate = ` -o string if specified, write the webassembly binary created by -p here - -o-wat string - if specified, write the uncompiled webassembly - created by -p here -p string h program to compile/run -port string @@ -375,9 +372,9 @@ const playgroundTemplate = `
-

WebAssembly Text Format

+

AST

-
+

Gas used:

Execution time (nanoseconds):

@@ -386,7 +383,7 @@ const playgroundTemplate = ` function runProgram() { const programData = document.getElementById("program").value; const output = document.getElementById("output"); - const watBox = document.getElementById("wat_box"); + const astBox = document.getElementById("ast_box"); const gasUsed = document.getElementById("gas_used"); const execTime = document.getElementById("exec_time"); const status = document.getElementById("status"); @@ -401,7 +398,7 @@ const playgroundTemplate = ` } status.innerHTML = "success"; - watBox.innerHTML = data.prog.wat; + astBox.innerHTML = data.prog.ast; output.innerHTML = data.res.out; gasUsed.innerHTML = data.res.gas; execTime.innerHTML = data.res.exec_duration; diff --git a/cmd/hlang/nguh/compile.go b/cmd/hlang/nguh/compile.go index d268d77..72fb6aa 100644 --- a/cmd/hlang/nguh/compile.go +++ b/cmd/hlang/nguh/compile.go @@ -135,6 +135,7 @@ func Compile(tree *peg.Node) ([]byte, error) { funcBuf.Write([]byte{ 0x20, 0x00, // local.get 0 0x10, 0x00, // call 0 + 0x01, 0x01, // two padding NOPs to get a single `h` binary to be 69 bytes. 0x0b, // end of function }) -- cgit v1.2.3