💾 Archived View for gemini.ctrl-c.club › ~nttp › toys › ripen captured on 2024-07-09 at 00:31:52. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-07-22)

-=-=-=-=-=-=-

Ripen scripting engine

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

Language overview

News

Guava

Tipsy Turtle

Beware that version 3.0 introduced breaking changes. Check the documentation.

Download

C++ port version 3.0 beta (2023-07-18); Boost Software License:

64-bit Linux build (38K)

32-bit Linux build (39K)

source code only (14K)

Nim port version 3.0 beta (2023-07-19); MIT License:

64-bit Linux build (90K)

32-bit Linux build (95K)

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.

Rugg/Feldman benchmarks (Wikipedia page)

Differences between versions

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.

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.

Roadmap

Version 4.0(?)

Main goal: find ways to make the language more immediately useful.

Support

Questions and feedback are welcome. All archives include contact information. See my homepage as well.

More small things

No Time To Play