[−][src]Module wasm_interface::parser
Parsers to get a wasm interface from text
The grammar of the text format is: interface = "(" interface name? interface-entry* ")" interface-entry = func | global
func = import-fn | export-fn global = import-global | export-global
import-fn = "(" "func" import-id param-list? result-list? ")" import-global = "(" "global" import-id type-decl ")" import-id = "(" "import" namespace name ")"
export-fn = "(" "func" export-id param-list? result-list? ")" export-global = "(" "global" export-id type-decl ")" export-id = "(" export name ")"
param-list = "(" param type* ")" result-list = "(" result type* ")" type-decl = "(" "type" type ")" namespace = """ identifier """ name = """ identifier """ identifier = any character that's not a whitespace character or an open or close parenthesis type = "i32" | "i64" | "f32" | "f64"
- means 1 or more
- means 0 or more
? means 0 or 1
| means "or"
""" means one
"
character
comments start with a ;
character and go until a newline \n
character is reached
comments and whitespace are valid between any tokens
Functions
parse_interface | Some example input: (interface "example_interface" (func (import "ns" "name") (param f64 i32) (result f64 i32)) (func (export "name") (param f64 i32) (result f64 i32)) (global (import "ns" "name") (type f64))) |