Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DebugMode = false
Functions ¶
func ParseModule ¶
Example ¶
package main import ( "fmt" "wa-lang.org/wa/internal/wat/parser" ) func main() { src := `(module $hello)` m, err := parser.ParseModule("hello.wat", []byte(src)) if err != nil { fmt.Println(err) return } fmt.Println(m) fmt.Println(m.Name) }
Output: (module $hello) hello
Example (Wa) ¶
package main import ( "fmt" "log" "os" "wa-lang.org/wa/api" "wa-lang.org/wa/internal/wat/parser" ) func main() { const filename = "a.out.wa" const src = `func main { println("hello wa") }` _, watBytes, err := api.BuildFile(api.DefaultConfig(), filename, src) if err != nil { log.Fatal(err) } m, err := parser.ParseModule("a.out.wat", watBytes) if err != nil { os.WriteFile("a.out.wat", watBytes, 0666) fmt.Println(err) return } fmt.Println(m.Name) }
Output: __walang__
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.