waforth
discussion
Our great sponsors
waforth | discussion | |
---|---|---|
6 | 5 | |
450 | 113 | |
- | 0.0% | |
7.0 | 0.0 | |
about 2 months ago | about 2 years ago | |
WebAssembly | ||
MIT License | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
waforth
-
Show HN: TinyWasm – A tiny WebAssembly Runtime written in Rust
Super nice project! I also spent the last month writing a WASM interpreter ( https://github.com/rrampage/wart ) using Java 21. I started it as an excuse to try out the pattern matching in switch / sealed classes in Java. It kind of snowballed in scope and can now run Doom and Waforth ( https://github.com/remko/waforth )! Have not yet tried compiling it to WASM and running it as a meta-circular interpreter.
-
Bunch of questions about forth
Concerning the point 8. There is an online Forth system demo Thurtle (in the browser) with turtle graphics, which is based on WAForth.
-
A Dynamic Forth Compiler for WebAssembly
There's a note on the page from 2022-08-19, that a lot has been added to it. It also links to the github page[1] for the up-to-date changes.
I am a Lisp, April, APL/J/BQE, and Forth[2] aficionado. I did some file munging programs in Factor back in 2012 at my job to sort through theater attendance logs in Word to compile statistics.
[1] https://github.com/remko/waforth
[2] https://factorcode.org/
- WAForth (WASM-based ANS Forth) supports interactive "notebooks" in VSCode
discussion
-
Retro: A Modern, Pragmatic Forth
> I would love a Forth with a type system. I don't know if that is heretical [...].
Mitch Bradley (of Open Firmware fame) thinks it’s old hat[1], so guess not. (He also thinks it won’t work though.) In general, people have tried a lot of times; there’s a number of postfix Lisps with type systems—Kitten mentioned elsethread, ActorForth[2], etc.; a low-level Forth, as in untyped cells on stack and no automatic memory management, I don’t think has been done to completeness (IIRC either Forth, Inc. or MPE have a standing offer for any that’s able to process their legacy code), but then C wouldn’t be complete by that standard either (and Rust far too limiting).
Honestly I’m not sure how well it would work—in C, you get a great deal of utility out of compound types, and classic cell-oriented Forth kind of sucks at even mildly complex datastructures—they are certainly possible, but being unable to manipulate them as values on the stack makes things quite unnatural. (And that’s where I draw the line of “postfix Lisps” like PostScript rather than Forths, as such manipulation doesn’t seem feasible without some sort of automatic memory management.)
[1] https://github.com/ForthHub/discussion/issues/79
[2] https://github.com/ActorForth/ActorForth
-
Making my own forth implementation
It’s not the minimum set of words you need, but it is practical. (This thread for example talks about a practical set of 32 words as a minimal starting set, and an impractical set of 7 which is 708 times slower haha https://github.com/ForthHub/discussion/issues/92 )
-
Bunch of questions about forth
Also concerning the point 1, ForthHub/discussions should be also mentioned. A Forth implementation of an FFI to Java is discussed there now.
-
Why no 2TO to pair with 2VALUE?
Have a look at the discussion "VALUE and TO" on GitHub/ForthHub.
-
Dear Sir, You Have Built a Compiler
With respect you've ignored the point I was making. There exist several Forth engines with native code-compilation, for instance VFX Forth, SwiftForth, and iForth.
> Typically the C version outperformed the Forth version by 3:1 or better, and I would not have known how to bridge that gap.
With a threaded-code Forth interpreter I'd expect the C version to outperform it by something closer to 5:1, so 3:1 doesn't sound too bad. The only way you can close the gap is with good quality native-code compilation.
> Nowadays with far larger caches Forth might do better, I haven't really worked with it for years.
It's interesting how advanced in CPU architecture change the relative performance of the different threading strategies. This has been nicely studied by the gforth folks. [0][1] Threaded-code interpreters still easily lose to optimising native-code compilers though, [2] and I expect they always will.
More on how Forth collides with low-level CPU matters: [3][4][5]
[0] https://www.complang.tuwien.ac.at/forth/threading/
[1] https://www.complang.tuwien.ac.at/forth/threaded-code.html
[2] https://github.com/ForthHub/discussion/issues/88#issuecommen...
[3] The Behavior of Efficient Virtual Machine Interpreters on Modern Architectures - https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.12...
[4] Branch Prediction and the Performance of Interpreters -
What are some alternatives?
forthlisp - A Small Lisp in Forth
gale - Strongly-typed, minimal-ish, stack-based development at storm-force speed.
JS-Monster - JavaScript is a BEAST, JS Monster portrays that awesomeness with a mascot inspired by the JS logo.
raillisp - A fast and portable lisp implemented in forth
cforth - Mitch Bradley's CForth implementation
ESP32forth - FORTH developments for ESP32
micropolis - Automatically exported from code.google.com/p/micropolis
the-power-of-prolog - Introduction to modern Prolog
sandspiel - Creative cellular automata browser game
swapforth - Swapforth is a cross-platform ANS Forth
xxhash-wasm - A WebAssembly implementation of xxHash
kitten - A statically typed concatenative systems programming language.