Add mechanism for displaying the WAT signatures of WASI modules#377
Add mechanism for displaying the WAT signatures of WASI modules#377abrown wants to merge 1 commit intoWebAssembly:mainfrom
Conversation
1288a74 to
8068d06
Compare
pchickey
left a comment
There was a problem hiding this comment.
This looks useful and I'm glad that its a very compact and easy thing to implement so far. I don't have a strong opinion about whether it should use a library to help render it - the current witx sexpr-rendering code does not, and probably should. Thank you for doing this!
Is this the ideal way to proceed? E.g. I see that SExpr implements |
|
That is the "good enough" solution I got working, but its still a pretty unpleasant output for a human to read because it doesn't try to put line breaks or whitespace in sensible places. @alexcrichton are you aware of any s-expr pretty printing libraries we could use? |
|
Nah unfortunately not that I'm aware of :( Crates like |
|
As discussed in today's WASI meeting (cc: @sunfishcode, @lukewagner), if/once WebAssembly/interface-types#132 is merged then this PR should be replaced by some tooling to do some form of "WITX-> WIT" conversion (i.e. generating an official core-wasm signature for the high-level WITX). |
|
Since this PR was filed, a lot has changed. Using wasm-tools, the signature of a component can now be printed using |
@pchickey, here are the beginnings of an idea for displaying signatures of WITX interfaces. What I need is some way to easily determine what WASI modules will look like after the WITX is translated away. I felt like WAT was a good format for this, though ideally I would want to generate the same type of information in other languages (e.g. as C headers or AssemblyScript declarations).
Currently, when I run
cargo run --example witx -- wat-signature ../../phases/ephemeral/witx/wasi_ephemeral_nn.witx, this PR outputs something like the following:I am seeking feedback on whether this type of helper command is useful to others before I invest more time to fix it up (e.g. use a proper WAT library, add comments, fix type casing, etc.).