#line but for WAT format
#1593
dragoncoder047
started this conversation in
Ideas
Replies: 1 comment 1 reply
|
Sounds like you want source maps, which are supported by convention in a Wasm custom section: https://github.com/WebAssembly/tool-conventions/blob/83e5d715d0c18aee51e2d5ae9434f22d67b6e905/Debugging.md?plain=1#L34 For .wat, Binaryen at least supports translating comments in the text format to source maps in binary modules: https://github.com/WebAssembly/binaryen/blob/main/test/lit/source-map.wast But I don't know if any other tools support the same source map comment formats. It doesn't seem to be documented in the tool-conventions repo. Maybe open an issue over there if it's something you would want to be supported more broadly in the ecosystem? |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm considering using WAT for JIT-compiling another programming language I'm making. The other language's JIT backend will output WAT, but when the toolchain (probably watr since it's tiny and pure Javascript) encounters an error the location will be relative to the WAT text and will not be meaningful for the actual source of my PL that ultimately produced that.
C has the
#line N "file"directive which tells the compiler that the contents below that directive start at lineNoffile. Does WAT have any equivalent? If not, maybe a(@custom.location <opaque identifier>)directive in appropriate places could do that. Defining the semantics/extent of such a directive I have not yet figured out but am open to discussion.All reactions