I tried creating a TinyCC target for asm.js and never really found a clean
way to do it because of lack of goto.  My goal was to build an in-browser
compiler for cheap wifi microcontrollers, the ESP8266 which could let you
write code, compile it and run it without the need for a development system
like Arduino.  There isn't xtensa support, but that wouldn't be hard to
add.

It turned all functions into whiles with complicated switch states.  I got
most of the control flow stuff working but it was AWFUL... And I ran into
the same issue with WebAssembly.  There was an interesting thread here:
https://github.com/WebAssembly/design/issues/796 which has been one heck of
a revealing thread between the two camps, where the general argument goes:

(1) But Goto. No, really goto.  (2) Eh, we don't need goto and there's this
boogyman we're worried about with it and it's dirty and makes us feel
dirty. (3) But really, this is paaainful for compiler writers. (4) Use
relooper.  (5) There's literally only one implementation and it's in C++.
(6) Use the C++ implementation.  (7) see 1.

I urge any person who is thinking about getting into languages to read that
thread to see how wild and dogmatic these things can get.

It looks like it's feasible to abuse some control flow constructs, like I
did with javascript, but unless you have some clever ideas, or any of the
proposals go through, it's going to be a while...  If you have some clever
ideas, it might be enough to make me go back and pick some projects up!!

On Wed, Feb 12, 2020 at 9:21 PM Christian Jullien <eli...@orange.fr> wrote:

> Hi,
>
>
>
> I’m not aware of any efforts to create a wasm backend for tinycc but this
> is something very interesting to consider.
>
>
>
> *From:* Tinycc-devel [mailto:tinycc-devel-bounces+eligis=
> orange...@nongnu.org] *On Behalf Of *Klaus T.
> *Sent:* Wednesday, February 12, 2020 23:53
> *To:* tinycc-devel@nongnu.org
> *Subject:* [Tinycc-devel] WebAssembly backend
>
>
>
> Hi, as the WebAssembly ecosystem is expanding fast, I am wondering if
> there are any plans to create a wasm backend for tinycc, especially given
> the existence of tiny wasm interpreters like wasm3.
> _______________________________________________
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to