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++. 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

As of 11 May 2021, Ripen (1.0) is used as the scripting language of Tipsy Turtle.

As of 20 December 2021, there's an offshoot called Guava, by eli.

As of 10 February 2022, Ripen 1.0 fails to build with Nim 1.6.4 (latest as of this writing). Stick to 1.4.8 if you need it to work. Version 2.0 was rewritten in C++ for this reason.

Download

Version 2.1.1 (10 April 2022):

Version 1.0 "May the Fourth" (4 May 2021):

All archives include documentation + examples.

Building and running

Ripen version 2.x is written in C++11, and requires a relatively modern compiler (tested with GCC 8.3.0, but 4.8.x should be enough). It's a single-header library that only depends on the STL.

The binaries run on Linux distributions as old as SalixOS 14.2; you'll have to build from source for anything older.

See the various makefiles and build scripts included with the source code.

Performance

The native build of Ripen 2.x is smaller but also slower than the previous version. 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 Python and JS versions, everything goes on the stack: numbers, strings and lists / code blocks. In C++, 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.

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.

License and support

Ripen is free and open source software under the Artistic License 2.0.

Questions and feedback are welcome. All archives include contact information.

If you like Ripen, please see on the blog for how to support me.