-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasm-tools parse support for .wast file. #1395
Comments
Ah yes so I'd be happy to see |
I did not have particular output format in mind, but I found that our team uses wast2json tool from wabt. What do you think about implementing wast support as a drop-in replacement for wast2json? Pro would be that it would be really useful for the migration of the users. |
Sounds reasonable to me! If you're up for making a PR that'd be most welcome as well, I'd be happy to review. If I might throw out an initial idea to help shape this a bit:
Please feel free of course to change any details as well, just some initial suggestions! |
I'll try to follow up with a PR with respect to your suggestion. Thanks! |
This commit is an implementation of bytecodealliance#1395 which brings wabt's `wast2json` functionality to `wasm-tools`. This is implemented entirely in the CLI since if using the crate it's already got all the functionality necessary for this. Additionally this PR attempts to be pretty close to `wast2json` from wabt in terms of structure and syntax. The main difference is that wabt fills out the expected return types of an operation when the operation isn't supposed to return (e.g. `assert_trap`), but `wasm-tools` won't do that as we don't have that information so easily available. This is tested by adding `*.json` files to the `snapshots` directory with example outputs from all known `*.wast` tests. Everything should be included except for the `component-model` tests at this time which don't have support in printing the args/results. Closes bytecodealliance#1395
* Implement a `wast2json` subcommand This commit is an implementation of #1395 which brings wabt's `wast2json` functionality to `wasm-tools`. This is implemented entirely in the CLI since if using the crate it's already got all the functionality necessary for this. Additionally this PR attempts to be pretty close to `wast2json` from wabt in terms of structure and syntax. The main difference is that wabt fills out the expected return types of an operation when the operation isn't supposed to return (e.g. `assert_trap`), but `wasm-tools` won't do that as we don't have that information so easily available. This is tested by adding `*.json` files to the `snapshots` directory with example outputs from all known `*.wast` tests. Everything should be included except for the `component-model` tests at this time which don't have support in printing the args/results. Closes #1395 * Fix tests on wasm * Fix building just wast2json * Generate the same test output on Windows * Rename to `json-from-wast` * Fix typo
Oh @alexcrichton thanks for implementing this. I thought about doing thsis early April because I have some important due date in a few weeks. Maybe I should have communicated it. Again thanks for your help! |
Oh I'm so sorry! I was feeling inspired the other night, but I also should have checked in here first before going ahead. |
No I am really grateful that you did it! No need to be sorry! |
From current README, I got the impression that both wat and wast crates are accessible from subcommand parse:
wasm-tools/README.md
Line 128 in d15fda3
But as I try out the command from the shell and also looking through the code, this doesn't seem currently possible:
wasm-tools/src/lib.rs
Lines 67 to 72 in 4975360
Is it intended? If not, may I contribute a feature addition?
The text was updated successfully, but these errors were encountered: