Est. 1987 Intermediate

User RPL

The stack-based programming language of Hewlett-Packard's HP-28 and HP-48 calculator families, blending Reverse Polish Notation with ideas from Forth and Lisp.

Created by Hewlett-Packard (William C. Wickes and the Corvallis calculator team)

Paradigm Stack-based, Procedural, Structured (RPN)
Typing Dynamic, Strong (typed objects with runtime argument checking)
First Appeared 1987
Latest Version No standalone versioning; shipped with HP calculator firmware through the HP 50g (discontinued 2015), with community continuations in newRPL and DB48X

User RPL is the high-level, stack-based programming language that Hewlett-Packard built into its most celebrated scientific calculators — the HP-28, HP 48, and HP 49/50 series. RPL stands for Reverse Polish Lisp, a name its developers chose as a play on RPN (Reverse Polish Notation, the postfix entry system long identified with HP calculators) and an acknowledgment of the language’s twin ancestors, Forth and Lisp. The “User” prefix distinguishes the safe, documented, user-facing dialect from System RPL, the lower-level internal variant in which the calculators’ own operating systems were written. For a generation of engineers, surveyors, and students, User RPL turned a pocket calculator into a genuine programmable computer — one where programs, algebraic expressions, matrices, and even graphics were all first-class objects on a single unlimited stack.

History and Origins

RPL was born at HP’s calculator division in Corvallis, Oregon, where development began in 1984. The team, which included physicist William C. Wickes, set out to solve a practical engineering problem: HP’s calculator operating systems had until then been written directly in assembly language for each machine, which made them expensive to build and hard to evolve. RPL was conceived as a compact, threaded interpretive language — influenced by Forth’s stack discipline and Lisp’s expressive list-based control — that could serve as the operating system implementation language across an entire product line.

The first calculator running RPL internally was the HP-18C Business Consultant of 1986, which kept the language hidden from its users. The breakthrough came with the HP-28C, released in 1987: it was the first calculator to expose RPL as its user programming language, and simultaneously the first handheld calculator with a computer algebra system, able to solve equations symbolically — all within 2 KB of usable RAM. Its successor, the HP-28S (1988), raised the memory to 32 KB, and in 1988 Wickes described the language publicly in the paper “RPL: A Mathematical Control Language.”

The language reached its widest audience with the HP 48SX, released in March 1990. The HP 48 series — 48SX and 48S, followed by the 48G and 48GX in 1993 — became one of the most beloved technical calculators ever made, and it was in the HP 48 era that the terminology of User RPL versus System RPL became standard: User RPL was the language you could program at the keyboard, while System RPL, faster but unprotected, required external tools and could crash the machine if misused. (HP’s marketing briefly floated the tamer backronym “ROM-based Procedural Language” in 1987, but the developers’ original name stuck.)

User RPL and System RPL

The two dialects are layers of the same system, and the relationship between them explains much of the language’s character:

  • User RPL is a safe subset. Every command validates its arguments before acting, so a program that feeds a string to a square-root function halts with a friendly error rather than corrupting memory. Every User RPL program is, internally, a System RPL program composed exclusively of these safety-checked entries.
  • System RPL dispenses with argument checking in exchange for speed and access to low-level operations. It was the implementation language of the calculators’ operating systems, and ambitious third-party developers used it for performance-critical software — accepting that a wrong argument could mean a memory-clearing crash.

This layered design meant users got an approachable, forgiving language, while HP and expert programmers shared the same underlying machinery. The HP 49G (1999) eventually brought System RPL development on-board, letting owners compile and decompile System RPL and Saturn assembly directly on the calculator.

Design Philosophy

User RPL generalizes HP’s classic RPN calculators into a full programming model:

  • An unlimited stack. Where earlier HP calculators had a fixed four-level stack, RPL’s stack is dynamic, limited only by available memory — and it holds not just numbers but any object the calculator understands.
  • Everything is an object. Real and complex numbers, binary integers, strings, lists, vectors and matrices, algebraic expressions, graphics objects (GROBs), tagged values, directories, and programs themselves are all typed objects that can be stored in variables, placed in lists, or passed on the stack.
  • Programs are data. A program is simply an object delimited by guillemets, « and ». Programs can be stored, passed to other programs, and applied — a directly Lisp-flavored idea.
  • Postfix with structure. Although evaluation is postfix, User RPL is a structured language, with IF…THEN…ELSE…END, CASE, FOR…NEXT, START…NEXT, WHILE…REPEAT…END, and DO…UNTIL…END constructs, plus local variables introduced with the arrow — a marked departure from the line-numbered, GOTO-driven keystroke programming of earlier calculators.
  • Symbolic and numeric together. Algebraic expressions written in ordinary infix notation (between tick marks, like 'X^2+1') coexist with stack operations, and the same program can manipulate an expression symbolically or evaluate it numerically.

A Taste of the Language

A User RPL program that computes the area of a circle from a radius on the stack:

1
2
3
4
« → r
  « π r SQ * →NUM »
»
'AREA' STO

Typing 5 AREA then leaves 78.5398163397 on the stack. The → r construct binds the stack value to a local variable r; SQ squares it; →NUM forces the symbolic constant π to a numeric value.

Loops read just as directly — summing the squares of 1 through 100:

1
« 0 1 100 FOR k k SQ + NEXT »

The 0 seeds an accumulator on the stack, and each pass of the FOR loop pushes and adds it. Idiomatic User RPL leans on the stack this way, and experienced programmers prized the terse, composable style that resulted.

Evolution

User RPL itself changed remarkably little across its lifetime — a deliberate continuity that let HP-28 techniques carry forward for decades — while the machines around it grew dramatically:

  • HP-28C/28S (1987–1988): the language debuts alongside the first handheld CAS; memory grows from 2 KB to 32 KB.
  • HP 48S/SX and 48G/GX (1990–2003): expansion cards, serial and infrared I/O, a larger screen with GROB graphics, and a vast third-party software culture; the 48GX offers 128 KB of RAM.
  • HP 49G (1999): HP’s first calculator with flash memory and upgradable firmware; System RPL tools move on-board, and the CAS deepens. In 2003 the 49G firmware’s CAS source code was reportedly released under the LGPL.
  • HP 49g+ and 48gII (2003), HP 50g (2006): the Saturn processor gives way to ARM chips running a Saturn emulation layer (with selected code paths patched to run natively for speed), while the RPL environment above it remains compatible.

The HP 50g, introduced in 2006, was the final RPL calculator. When HP discontinued it in 2015, official production of RPL hardware ended after nearly three decades — HP’s subsequent flagship, the Prime, adopted a Pascal-like language (PPL) instead.

Current Relevance

Discontinued hardware has not meant a dead language. The RPL community remains genuinely active:

  • newRPL, begun around 2013, is an open-source, from-scratch reimplementation that replaces the firmware on HP 50g-class calculators (and runs on PCs), modernizing the engine while preserving the RPL programming model.
  • DB48X, presented at FOSDEM in 2023, brings an RPL implementation inspired by the HP 48 family to SwissMicros DM42/DM32 hardware and to a browser-based simulator.
  • Emulators such as Emu48 and its descendants run the original calculator ROMs on modern desktops and phones, and the hpcalc.org archive continues to host thousands of User RPL programs accumulated since the 1990s.
  • The Museum of HP Calculators forums sustain an ongoing culture of RPL programming challenges, library development, and language discussion.

Used HP 48 and 50g calculators still command healthy prices on the secondary market, sustained in part by professionals and enthusiasts who never found a replacement for the RPL way of working.

Why It Matters

User RPL is arguably the most sophisticated programming language ever shipped as the native interface of a mass-market handheld calculator. It put a stack machine with first-class functions, structured control flow, a rich object system, and symbolic mathematics into a shirt pocket — years before general-purpose portable computing existed in any comparable form. As a design, it is a rare successful synthesis of Forth and Lisp; as a product, it powered machines that engineers trusted with bridges, circuits, and land boundaries; and as a culture, it seeded software archives and communities that are still writing and running RPL today, decades after the last calculator left the factory. Its desktop descendant RPL/2 and the newRPL and DB48X projects are evidence of an idea that outlived its hardware.

Timeline

1984
Development of RPL begins at Hewlett-Packard's Corvallis, Oregon facility, led by William C. Wickes and colleagues, to replace assembly language as the implementation language for calculator operating systems
1986
The HP-18C Business Consultant ships as the first calculator implemented internally in RPL, though it does not expose the language to users
1987
The HP-28C is released — the first calculator to make RPL available to users, and the first handheld calculator with a computer algebra system, in just 2 KB of usable RAM
1988
The HP-28S arrives with 32 KB of RAM, and William C. Wickes presents the paper "RPL: A Mathematical Control Language" describing the language's design
1990
The HP 48SX is released in March 1990, with expansion card slots; its documentation and community establish the distinction between User RPL (the safe, user-facing language) and System RPL (the internal implementation language)
1993
The HP 48G and 48GX succeed the S series, with the 48GX offering 128 KB of RAM and expandable storage; the 48G series remains in production until 2003
1999
The HP 49G launches in August 1999 as HP's first calculator with flash memory and upgradable firmware, adding the ability to compile and decompile System RPL and Saturn assembly directly on the calculator
2003
The ARM-based HP 49g+ appears in August 2003, running the RPL system on a Saturn emulation layer; the same year, the CAS source code of the 49G firmware is reportedly released under the LGPL
2006
The HP 50g is introduced — the last Hewlett-Packard calculator built on RPL
2013
The newRPL project, an open-source reimplementation of RPL for HP 50g-class hardware, is started by community developer Claudio Lapilli around this time
2015
HP discontinues the HP 50g, ending nearly three decades of official RPL calculator production
2023
DB48X, a modern RPL implementation for SwissMicros DM42/DM32 hardware honoring the HP 48 legacy, is presented at FOSDEM 2023

Notable Uses & Legacy

Engineering and science professionals

Through the 1990s the HP 48 series was a fixture among electrical, mechanical, and civil engineers, who wrote and exchanged User RPL programs and custom libraries for unit conversion, circuit analysis, and numerical methods directly on the calculator.

Land surveying

The expandable HP 48GX became a de facto field computer for surveyors, hosting commercial plug-in survey software cards alongside home-grown User RPL coordinate-geometry (COGO) programs.

hpcalc.org software archive

The long-running community archive hosts thousands of user-contributed HP 48 and HP 49/50 programs — games, math libraries, engineering tools — a large share of them written in User RPL.

Engineering education

University engineering and mathematics students of the late 1980s and 1990s used HP-28 and HP-48 calculators for symbolic algebra and calculus, with User RPL programs automating coursework computations.

Modern open-source recreations

Community projects newRPL and DB48X reimplement and extend the RPL programming model on repurposed HP 50g hardware and SwissMicros calculators, keeping the language usable on current devices.

Language Influence

Influenced By

Influenced

RPL/2 newRPL DB48X

Running Today

Run examples using the official Docker image:

docker pull
Last updated: