Est. 1998 Advanced

RPL/2

A stack-based, Reverse Polish Notation language for scientific and parallel computation on POSIX systems, descended from the RPL of Hewlett-Packard calculators.

Created by Joël Bertrand

Paradigm Stack-based, Procedural, Concatenative
Typing Dynamic, Weak (variables typed on first use)
First Appeared 1998
Latest Version RPL/2 4.1.24 (2016)

RPL/2 (Reverse Polish Lisp/2) is a stack-based programming language designed for scientific and symbolic computation on POSIX-compliant systems. Created by French developer Joël Bertrand, it reimagines the RPL language of Hewlett-Packard’s programmable calculators as a full development environment for Unix-like workstations and parallel computers. Bertrand describes it, half-jokingly, as the offspring of “the forbidden love between Lisp and Forth” — it borrows Reverse Polish Notation and stack addressing from Forth, while taking the expressive power of its control structures from Lisp.

History and Origins

The story of RPL/2 begins in 1989, when Bertrand bought a Hewlett-Packard 28S scientific calculator and was struck by the power and extensibility of its built-in RPL language. Unable to find a comparable language for a workstation, he set out to build one himself. His first attempt ran on a development board built around a Rockwell 6502 processor with only about 48 kilobytes of memory — a considerable challenge given the program’s complexity and the modest speed of an 8-bit chip.

A later reimplementation took shape on a Goupil G3 equipped with a Motorola 68B09 processor running the TSC-Flex9 operating system. Although that machine offered a then-generous 576 KB of memory, Flex9’s paged, 64 KB-window memory model made the work awkward, and the version was never released because Bertrand could not complete an editor for it.

The decisive turn came in 1998. As modern operating systems on standard workstations brought richer memory management and high-level compilers, the original static-memory design proved inefficient and hard to evolve. Bertrand rewrote the internal structures from scratch in C and Fortran, added features absent from the original calculator language, and renamed the project RPL/2 to distinguish his implementation from HP’s RPL. From that point forward the language was aimed squarely at scientific programming on parallel computers.

Because the project grew organically from the late 1980s and was renamed only in 1998, exact “first appearance” dating is necessarily approximate. The 1998 rewrite is the most clearly documented origin of RPL/2 as such; the broader lineage reaches back to the 1989 experiments.

Design Philosophy

RPL/2 is unapologetically a stack-oriented language. There is no concept of program lines in the conventional sense, and its notation can appear unusual to newcomers: operands are pushed onto a single standardized stack, and operators consume and replace values on that stack. This is the Forth inheritance — concise, postfix, and immediate.

From Lisp, RPL/2 takes its richer control structures, giving it conditional and looping constructs more expressive than a bare concatenative language would typically offer. The result sits at an unusual intersection of two very different traditions.

The language uses weak, dynamic typing. Variables are not declared in advance; instead, a variable comes into existence the first time it is assigned, taking the type of the data given to it. Notably — and in contrast to the automatic variables of dialects like BASIC — a variable that has never been initialized simply does not exist. The type of a variable may also change over the course of a program’s execution.

Key Features

RPL/2 supports a broad range of data types suited to numerical and symbolic work:

  • Binary and signed integers
  • Real and complex numbers
  • Vectors and complex vectors
  • Integer, real, and complex matrices
  • Strings, lists, and tables
  • Names (symbolic identifiers)
  • Algebraic expressions and Reverse Polish (RPN) expressions as first-class objects

Other defining characteristics include:

  • Dual execution model — RPL/2 uses a preprocessor that transforms a command file into an intermediate form which can either be interpreted (giving access to an internal debugger) or compiled. Source files are plain text.
  • POSIX foundation — the implementation is built on the system calls described in the POSIX:2001 standard, which Bertrand credits for reliable thread and process handling. The project’s portability strategy was deliberately tied to POSIX conformance, and the author was openly skeptical of non-POSIX platforms because of deadlocks and memory issues he attributed to them.
  • Parallelism — through POSIX threads and processes, RPL/2 was intended to run scientific programs in multiprocessor environments and on parallel calculators.
  • Type inference and extensibility — the project described itself as a compiled, type-inferring, and extensible language.

Platform Support

RPL/2 was distributed as source code and, according to the project’s own status pages (circa 2016), built and ran with varying degrees of completeness across a wide spread of POSIX-oriented systems, including AIX, FreeBSD, HP-UX, GNU Hurd, GNU/Linux (notably Debian), macOS X (then “Mac OS X”), NetBSD, OpenBSD, OpenVMS (via the GNV environment), OS/2 Warp and eComStation, OpenSolaris/SunOS, and Windows under Cygwin. Some of these were marked as fully working, others as degraded or work-in-progress, and the author offered downloadable patches for unsupported systems rather than merging platform-specific hacks into the main sources.

Building the language required a C compiler and Fortran compiler — specifically GCC 4.3 or later and gfortran 4.3 or later in the documented configurations — with LaTeX, dvips, and gv as optional tools for generating documentation.

Evolution

Public stable releases are documented from the late 2000s onward. The 4.0 series reportedly began with version 4.0.0 around 18 May 2009 and progressed through many point releases. The 4.1 series opened with version 4.1.0 in mid-2011 (version 4.1.4 is documented as released 7 October 2011) and continued steadily; version 4.1.24 appeared reportedly on 1 March 2016, with automated daily snapshots shortly after. The version numbering suggests several earlier iterations during the language’s first decade as RPL/2.

Licensing

RPL/2 is free software, distributed under the CeCILL license version 2.0 (dated 5 September 2006), a license written under French law and designed to be compatible with the GNU GPL. The name “RPL/2” is also noted by its author as a registered trademark.

Current Relevance

RPL/2 has always been a niche project — the work of a single dedicated author serving a small community of scientific and calculator-programming enthusiasts. The last widely archived stable release dates to 2016, and the original project domains (rpl2.net and rpl2.fr) reportedly no longer host the language. The software remains downloadable from free-software archives and source mirrors, and it is, by design, still buildable on modern POSIX systems, but it should be regarded as dormant rather than actively developed.

Why It Matters

RPL/2 is a fascinating example of a personal project pursued with rigor over decades. It preserves and extends the distinctive RPL programming model — beloved by users of HP’s high-end calculators — and carries it onto general-purpose computers, marrying that calculator heritage to serious numerical and symbolic computation. As a deliberate hybrid of Forth’s postfix, stack-based execution and Lisp’s control structures, it stands as a thoughtful experiment in language design, and as a reminder of how a single enthusiast can keep an idiosyncratic but genuinely useful tool alive for a generation.

Timeline

1989
Joël Bertrand buys a Hewlett-Packard 28S calculator and is inspired by its RPL language; begins experimenting with an RPL interpreter on a Rockwell 6502 development board
1990s
An early reimplementation is attempted on a Goupil G3 (Motorola 68B09) running TSC-Flex9, but is never released for want of a complete editor
1998
Bertrand rewrites the internal structures in C and Fortran for modern workstations and renames the project RPL/2 to distinguish it from HP's original RPL
2001
The implementation is targeted at the POSIX:2001 system-call standard, enabling portable thread and process management for parallel computation
2006
RPL/2 is distributed under the CeCILL license version 2.0 (a French GPL-compatible free-software license)
2009
Stable release series 4.0 published, beginning with version 4.0.0 (reportedly 18 May 2009)
2011
Stable release series 4.1 begins, with version 4.1.0 appearing in mid-2011 (version 4.1.4 is documented as released 7 October 2011)
2016
Version 4.1.24 released (reportedly 1 March 2016), among the last widely archived stable releases; the official site later went dormant

Notable Uses & Legacy

Numerical algorithm development

Designed for writing and porting numerical algorithms on workstations and parallel calculators, with native support for real and complex numbers, vectors, and matrices.

Symbolic computation

Provides algebraic and Reverse Polish expression objects, enabling symbolic manipulation alongside numeric evaluation in the same stack-based environment.

Parallel and cluster computing

Built on POSIX threads and processes so that scientific programs can exploit multiprocessor environments and parallel calculators.

RPL on the desktop

Offers calculator-style RPL programmers a comparable environment on Unix-like workstations, the original motivation behind the project.

Language Influence

Influenced By

Running Today

Run examples using the official Docker image:

docker pull
Last updated: