ForthHub/discussion

Anyone compiling Forth VMs to WASM yet?

Opened this issue · 4 comments

I just compiled a small-ish Forth VM to Web Assembly. It works (meaning, it can evalutate strings and perform character I/O), but it is hogging all of the resources on the main tab and is not usable in its current form. I suspect error on my part rather than a bug in the original VM source because it runs just fine on native Linux.

Has anyone worked with WASM yet? Anyone have any ideas where I went wrong on this one? Comments appreciated. Here's a reproducible use case: https://github.com/RickCarlino/WASM-Forth

@pipcet ported my Forth to asm.js. I think he did some work on wasm as well.

Rick,
I try to generate WASM like jit compiler but two main dificult appear.
First, WASM work with a stack data but only one parameter can be return, this is an artificial limitation, search multi value return in wasm forum, perhaps change in the future, if not, I need simulate the data stack. Return stack is not accesible but you can llive with this, simulate too.
Other is the ausence of jmp or goto, I compile to x86 and not to hi-level lang, I need this for an eficient compile

This too looks v. interesting: https://github.com/stefano/wasm-forth