RPN Calculator Implementations
(currently in 61 languages)

The following links lead to implementations of the calculator in the respective languages. Each implementation is accompanied by an explanation.

In some languages, there are more than one implementations of the calculator, but most of them are ‘hidden’ as HTML comments (one has to read the page sources in order to find them).

ABC Ada Algol 60 Algol 68 AWK Bash BASIC BCPL C C with Lex & Yacc C++ C# Cilk CLU D Dylan Eiffel Erlang Euphoria Factor Falcon Fortran Go Haskell Icon Io Java JavaScript Julia K Lisp Logo Lua ML Nial Oberon Objective-C OmniMark Oz Pascal Perl PHP Pop-11 PostScript Prolog Pure Python REBOL Refal Rexx Ruby Rust Scala Scheme SETL Smalltalk Snobol Tcl TXL U Vim script

The program text is displayed in colour, like good text editors do. This not only improves readability by making the lexical structure of a program more discernible, but also assists the reader in guessing the roles that the different tokens play in the language. The following classes of tokens are being discriminated between:

Colour encoding lets one instantly observe, e. g., that:

ABC uses commands for what other languages have built-in or library procedures;
PostScript, Smalltalk, and Snobol have no commands at all, but make extensive use of built-in procedures, of which they have plenty;
Icon also abounds with built-in procedures, but also enjoys commands;
Pascal has a few built-ins and no standard library;
Oberon and Go have a few built-ins, too, but they rely more on standard library procedures;
– other languages have no built-ins, resorting entirely to library procedures, etc.

There are cases where classifying a certain token according to the above set can be decided in more than one way or not at all, or the choice made is disputable, but in general colouring helps a lot.