IIRC the WebAssembly text format (.wat) is not able to express everything .wasm can, such as
binary (custom) sections. I'm not sure about the current state of WebAssembly text and binary formats now though.
I asked here recently about how I could add source locations (including the full call stack) to thrown exceptions in C++ and got this answer suggesting the
#line directive (which can be useful in my case) and the use of
libunwind to collect the call stack.
I was thinking of researching on the WebAssembly target for avoiding possible name clash and reserved keywords issues and also because I'm not experienced with C++.
I'm wondering if it's feasible to target .wat since writing the binary manually requires more work. Did any language do this in practice? I know Lobster targets the binary format (.wasm), but I use another language for my type checker, C#, and Lobster's writer is written in C++, so it may be problematic to port it.
It looks like C# does have a library for writing .wasm: https://github.com/RyanLamansky/dotnet-webassembly