💾 Archived View for gemini.ctrl-c.club › ~nttp › toys › ripen captured on 2024-03-21 at 15:43:47. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-07-22)
-=-=-=-=-=-=-
Welcome to Ripen, a stack-based scripting engine with highly readable syntax, that can be implemented with little code and effort in a language like C++ or Nim. It's informed by RetroForth and PostScript, but diverges from either in important ways, not least due to its string-threaded nature.
Ripen is based on principles explained in the article linked below:
More about tiny scripting engines
The point is having a single-file engine, easily copy-pasted into any application. For this reason, the default vocabulary is kept small. See below for more details, but for a quick start try:
( Hello, world! ) type cr 3 2 + 3 2 * < . cr
Beware that version 3.0 introduced breaking changes. Check the documentation.
C++ port version 3.0 beta (2023-07-18); Boost Software License:
Nim port version 3.0 beta (2023-07-19); MIT License:
All archives include documentation + examples. See also:
old Python prototypes (13K); for educational purposes
Ripen has multiple implementations; notes and/or build scripts are included with each source archive.
Binaries are built on a Debian 10 machine, and seem to have decent compatibility with other / older distributions. No promises.
The C++ port of Ripen is smaller but also slower than the Nim port. An informal test was performed with a modified version of the Rugg/Feldman benchmarks (#5), ported like this (yep, it's a one-liner):
:nop ; { $i 2 / 3 * 4 + 5 - =a nop } 1000 times $a . cr
While timings for this are hard to get on a modern PC, Ripen appears to be faster than Python 2.7, and even Tcl. Of course, both are much more complex.
Rugg/Feldman benchmarks (Wikipedia page)
In the Python version, everything goes on the stack: numbers, strings and lists / code blocks. In C++ and Nim, lists and strings go to their own memory areas. That requires a number of additions, like the ? sigil used to show the definition of a user-defined word, and .. to display the contents of the scratch pad.
The C++ port only defines `included` in the stand-alone interpreter.
Nothing at all! My very first Forth interpreter, that I made in 2009 for a tutorial, had parsing words and even quoted strings. This time I simply wanted to try something different after seeing RetroForth.
The library proper is still just one file, ripen.hpp; the other one is a demo driving app so you can see that it works, and how to use it in your own projects.
Main goal: find ways to make the language more immediately useful.
Questions and feedback are welcome. All archives include contact information. See my homepage as well.