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 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 the language overview.
News
- 2 March 2023
- C++ port has been refreshed and relicensed.
- 1 March 2023
- Nim port has been revived and relicensed; see below.
- 10 February 2022
- Ripen was ported to C++ as "version 2.0".
- 20 December 2021
- There's now an offshoot called Guava, by eli.
- 11 May 2021
- Ripen (1.0) is used as the scripting language of Tipsy Turtle.
Download
C++ port version 2.1.1a (2023-03-02); Boost Software License 1.0:
- 64-bit Linux build (37K)
- 32-bit Linux build (38K)
- source code only (13.5K)
Nim port version 1.1 (2023-03-21); MIT License:
- 64-bit Linux build (88K)
- 32-bit Linux build (93K)
- source code only (37K)
All archives include documentation + examples. See also:
- old Python prototypes (13K); for educational purposes
Building and running
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.
Performance
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.
Differences between versions
In the JS 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 type
to display the contents of the scratch pad.
The C++ port only defines included
in the stand-alone interpreter.
The JS port has alert, confirm and prompt words, but not included or bye.
Frequently Asked Questions
- What do you have against parsing words?
- 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.
- Does Ripen count as single-file anymore? The C++ code consists of two files.
- 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.
Support
Questions and feedback are welcome. All archives include contact information. See my homepage as well.
If you like Ripen, please see on the blog for how to support me.