5 ms·
Is there a Forth made for scripting/embedding in an application?
by irq-1 2y ago
Is there a Forth made for scripting/embedding in an application?
- astrobe_ 2y agoAccording to ChatGPT, there's GForth, SwiftForth, Forth-83, eForth and picoForth, but I cannot really tell how true it is. I use my own implementation, which I wish to publish someday but that's extra work for me to "anonymize" it. Probably the closest to it among ChatGPT's suggestion is eForth, but it's unfortunate IMHO they use C++.
- kragen 2y agoChatGPT is, as usual, full of shit here. Forth-83 is not an implementation but a standard, superseded by the ANSI standard in 01994, though sometimes people confuse it with F83, which is Laxen and Perry's public-domain implementation of the Forth-83 standard. It came out in 01984. It runs on CP/M and MS-DOS, but the MS-DOS version is limited to a single 64-kibibyte segment. It has no facilities to support embedding it in a program written in another language. eForth, if by that you mean Bill Muench's eForth, is written in, mostly, Forth, on top of a small assembly-language core. It also has no facilities to support embedding it in a program written in another language. GForth is pretty usable and can be embedded, as documented in https://gforth.org/manual/Integrating-Gforth.html https://gforth.org/manual/Integrating-Gforth.html (which is down at the moment but will probably be back up soon along with forth-standard.org.) I don't know anything about SwiftForth and picoForth, but so far ChatGPT is 1 for 3, so I wouldn't bet much on those either.
- astrobe_ 2y agoThe eForth I commented on indeed derives from Muench and Dr Ting [1]. About GForth, it doesn't look convincing - actually the feature looks like an afterthought (like those libraries that have been teared out of a program, e.g. libCurl). This use-case isn't well covered for Forth it seems, because the focus has always been mostly on the other embedding. That's why I'd recommend again the DIY route. [1] https://github.com/chochain/eforth https://github.com/chochain/eforth
- stevekemp 2y agoA toy golang one you can embed, and a tutorial for how it was written here: https://github.com/skx/foth https://github.com/skx/foth You can see it embedded to provide a turtle-like graphics thing in this repository: https://github.com/skx/turtle https://github.com/skx/turtle
- kragen 2y agoATLAST https://www.fourmilab.ch/atlast/atlast.html https://www.fourmilab.ch/atlast/atlast.html is one, and PFE and GForth can also be used in that mode.