6
$\begingroup$

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

$\endgroup$
1
  • 1
    $\begingroup$ Tangential to the question, but if you target wasm, you might face this issue. $\endgroup$
    – Bubbler
    Jun 29, 2023 at 23:57

1 Answer 1

3
$\begingroup$

Well, the main compiler for my programming language, the AEC-to-WebAssembly compiler, does output .wat and use wat2wasm. My programming language doesn't have exceptions, though, nor would I know how to implement them.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .