Est. 1994 Advanced

Kvikkalkul

A digits-and-punctuation programming language that an anonymous 1994 Usenet poster claimed to have used on secret Swedish Navy submarine computers in 1957, and which is generally regarded as a hoax

Created by Anonymous ([email protected], via alt.folklore.computers)

Paradigm Procedural (imperative, goto-based)
Typing Single data type: signed fixed-point fraction in (-1, 1)
First Appeared 1994
Latest Version kvik Kvikkalkul-to-C translator by Asher Hoskins (November 1994)

Kvikkalkul is a programming language with no letters in it. Every variable, label and subroutine is a number, every operator is built from the characters (, ), -, : and /, and comments are not allowed. Its only data type is a signed fixed-point fraction strictly between -1 and 1. It first appeared in October 1994, when an anonymous Usenet poster said they had used it in 1957 to program secret computers for the Swedish Navy’s submarines. Nobody has ever produced evidence that the language, or the computer it was said to run on, existed before those posts. Most sources that discuss it, including the first person to implement it, treat it as a hoax. Even so, it is a detailed and internally consistent design, and someone built a working compiler for it within a month.

History & Origins

The Usenet postings

On 20 October 1994 a message titled “REPOST: kvikkalkul” appeared in the newsgroup alt.folklore.computers. It came through anon.penet.fi, the Finnish anonymous remailer, so the author’s identity was hidden behind the address [email protected]. The subject line says “REPOST”, which suggests an earlier attempt, but the 20 October message is the earliest copy that survives in the sources we checked.

The message opens with a warning:

Note: this message contains top secret information of the Swedish Navy. Possession of this information in Sweden can (and will in most cases) lead to Capital Punishment. DO NOT DISTRIBUTE THIS INFORMATION TO SWEDEN!!!

The poster says they worked for the Swedish Navy in 1957, writing programs for a computer called SABINA. They describe it as “one of the first transistorised computers in the world, manufactured by SAAB for use on Swedish submarines”, installed at a test facility in Karlskrona. Besides “real-time submarine applications such as guided torpedo control”, they say they also wrote an accounting package in the language. The rest of the roughly 400-line message is a full language manual: character set, number system, operators, objects, channels and a list of library routines.

A week later, on 27 October 1994, a second message, “More factoids about kvikkalkul”, answered questions from readers. It explained:

  • The name. “Kvikkalkul” is Norwegian rather than Swedish, supposedly because Norwegians were on the design team. The name was believed to be a pun on Konrad Zuse’s Plankalkül, though the poster adds that the two languages have “hardly anything in common”.
  • The purpose. The poster claimed the language was developed for a Swedish nuclear weapons program, and that the secrecy also meant a Soviet spy holding a program tape would think it was encrypted text.
  • The probabilistic jump. A construct from a 1956 handbook that had been removed before the poster started (see below).
  • Working practice. Programs were never run without a supervisor’s approval, and paper tapes were colour-coded by purpose: white for source, green for compiled binaries, orange for system programs, pink for initialization dumps, yellow for typed input and blue for program output.

A third message, an example program called “1000000 Hail Mary’s in kvikkalkul”, circulated as well. Its headers did not survive, so its exact date and newsgroup are unknown.

Why it is considered a hoax

The case against the story is circumstantial, but it is strong:

  • No record outside the posts. There is no independent trace of a SAAB submarine computer called SABINA, or of a Swedish military language called Kvikkalkul. Swedish Wikipedia calls the language “probably fictional” and SABINA invented as well.
  • The capital punishment warning doesn’t fit. As the esolangs.org wiki points out, Sweden abolished the death penalty for peacetime crimes in 1921 and for all crimes on 1 January 1973. A secrecy breach could not have been a capital offence in 1994.
  • The tone. It compares Kvikkalkul to INTERCAL, has a jump that runs backwards like COME FROM, and ends with the remark “A pity they didn’t keep it :-(”. All of these read as alt.folklore.computers humour.
  • The first implementer called it a troll. Asher Hoskins wrote in his compiler’s README: “The posting was probably a troll but I was feeling silly so I decided to write a compiler for it.”

FOLDOC is more cautious and calls it “an open question whether the posts were a troll, a subtle parody or truth stranger than fiction could ever be”. Either way, the language exists in practice only through the 1994 postings and what people built from them. That is why this page dates it to 1994 and not to the 1950s setting of the story.

Design Philosophy

According to the postings, Kvikkalkul was deliberately made hard to use. The second message explains it like this:

Kvikkalkul was not designed to make it easy to write programs, but rather to make it next to impossible to write programs that more or less appeared to work without thinking. It was believed that a friendly language would make sloppy programmers and in fact this turned out to be true….

Each of its oddities comes with a reason in the story:

  • No letters, because programs were typed on five-bit Baudot teletypes, and the language used only the “figures” shift. Any letters typed were read as the figures-mode characters on the same keys.
  • No comments, because a comment could claim that code did X when it really did Y, and that “could be dangerous”.
  • No self-modifying code, because supervisors were “really paranoid about programs that modified their own code and grew wild”.
  • One fractional data type, so that numeric precision could be increased in later hardware “without breaking existing programs”.

Key Features

Character set

Source text could use only CR/LF, space, the digits 0-9, and the characters . , " : - / ( ). Each statement went on its own line.

Numbers

The only data type was a signed fixed-point fraction. The original description guarantees at least 15 bits: a sign bit and 14 fraction bits, in one’s complement. That gives 16,383 positive values, zero and 16,383 negative values. The word with every bit set (minus zero) meant overflow, and any operation whose result fell outside (-1, 1) returned it. Numbers were written with a leading comma, the Swedish decimal separator, so ,125 means 1/8. Even array indexes were fractions.

Operators

The operators are made of parentheses, dashes and colons, which makes the code look like a row of sideways smileys:

OperatorMeaningOperatorMeaning
(-assignment::equal
-)points to / jump:/:not equal
((previous(less than
))next)greater than
-/-plus(:less or equal
--minus):greater or equal
)(times-unary minus
-:-divide

Objects

The language had five kinds of object, each with ten instances numbered 0-9. The poster said there were really sixteen of each, but the other six were secret and reserved for library routines.

PrefixObjectExample
.register.9 (- ,5 sets register 9 to 1/2
/data pointer/0 -) 333 points data pointer 0 at data area 333
:program pointer:2 -) 4400 then -) :2 jumps to label 4400
"constant"3 is 1/π, "4 is ln 2, "9 is the largest number
(n)channel(0) is the teletype, (2) the real-time clock

There are no named variables and no expressions with more than two operands. Data areas are declared with a label and a size (333/ 44). To index into a data area, you take the smallest power of two that is at least its size and write the index as a fraction of it. In a 44-word area (rounded up to 64), element 16 is at ,25.

Subroutines without a call instruction

Kvikkalkul has no call statement. By convention, program pointer 0 holds the return address. The caller loads :0 with a label, loads another program pointer with the subroutine’s address, jumps to it, and the subroutine eventually jumps back through :0. Library routines sit at reserved labels below 1000. For example, 100 prints register 0, 200 sends CR/LF, 400 is square root, 666 is emergency stop, and 888 dumps the program’s state to paper tape.

Routine 888 is one of the language’s more unusual ideas. Kvikkalkul has no string literals, so a program that needed text or precomputed tables read them in on its first run and then called 888. The compiler combined the resulting dump with the program to build a production binary that started with its tables already filled in.

The probabilistic jump

The second posting describes a construct that was supposedly deleted before 1957. A numeric operand in front of the jump operator turned it into a jump with that probability, so ,333333 -) :4 would jump one time in three. If the number was negative, the jump went the other way, as if the destination had a jump back to the source. The poster compares it to INTERCAL’s COME FROM. It was replaced by a random number channel, (3), which used germanium noise diodes and, in the story, returned the overflow value “almost all the time” when it ran hot.

Example: Hello, World

Kvikkalkul has no string literals, so text is printed by writing Baudot codes, each divided by 32, to the teletype channel (0). This program comes from the kviksrc directory of Asher Hoskins’ 1994 translator. Decoded with the translator’s own Baudot table, it switches to letters, prints HELLO, shifts to figures for the comma, shifts back to letters for a space and WORLD, and then calls library routine 200 to send CR/LF:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
(0) (- ,96875

(0) (- ,15625
(0) (- ,50000
(0) (- ,28125
(0) (- ,28125
(0) (- ,09375
(0) (- ,84375
(0) (- ,18750
(0) (- ,96875
(0) (- ,12500

(0) (- ,78125
(0) (- ,09375
(0) (- ,31250
(0) (- ,28125
(0) (- ,56250

:0 -) 1000
:1 -) 200
-) :1
1000:

The last four lines are the standard calling sequence. Set the return address in :0, point :1 at the library routine, jump, and land on label 1000: when it returns.

Evolution

Inside the story

The first posting ends with a section called “Kvikkalkul Today”, which the poster admits is based on “rumours” and “intelligent guesswork”. In it, the language was still in use as of 1991. Guaranteed precision had grown to at least 32 bits, and labels could go up to 4,000,000,000. Angle brackets could replace parentheses, and + and = could replace -/- and ::. A new channel 8 drove a floating-point processor, and channel 9 gave access to operating system services. New programs were supposedly written in Ada and machine-translated into Kvikkalkul, which stayed the definitive reviewed version, and in the 1970s there had been a Simula-to-Kvikkalkul translator. The poster also says a former colleague ran their 1958 accounting package on a modern compiler in 1991, and that it worked “flawlessly, except that the year cannot be set beyond 1973”.

None of this has any record outside the posting itself.

Kvikkalkul ‘95

On 1 April 1995, according to Cadenhead’s archive, an announcement of KvikKalkul ‘95 appeared. It was an object-oriented version (“Even COBOL goes OO, so KvikKalkul had to follow the trend”) with numeric class IDs and methods. It also named the original poster as “Phil Hyatss” and claimed he was now in prison. It describes a “Visual KvikKalkul” from a company “headed by Guillaume Portes” (a French rendering of Bill Gates) and a military edition that keeps the old math libraries’ inaccuracies because classified algorithms depend on them. Given the date, it is an April Fool’s joke.

Real implementations

  • kvik (November 1994). Asher Hoskins, writing from a Philips Research address, built a compiler that translates Kvikkalkul to C. It came with a grammar, a token list, the library routine table, a Baudot table and 18 sample programs. The README says it was tested on a Sun386i under SunOS 4.0.2 and a SPARCstation IPX under SunOS 4.1.3_U1, and Hoskins said he had “no idea whether it’ll run on anything else”. It stores numbers in 16 bits but restricts them to a decimal-friendly range of about ±0.99995. Labels can be at most four digits long.
  • PowerMac port (December 1994). A Power Macintosh build of kvik was released from Boston College in a note dated 2 December 1994, which describes it as “a PowerMac implementation of a truly sick computer language”.

Current Relevance

Kvikkalkul is a piece of computing folklore and is not in active use. What survives:

  • Rogers Cadenhead’s Kvikkalkul home page, which collects the three postings, the Kvikkalkul ‘95 announcement and both translator archives. It was featured in his 1997 book Teach Yourself to Create a Home Page in 24 Hours and is still online at workbench.cadenhead.org.
  • Eric S. Raymond’s Retrocomputing Museum, which lists it as “a very odd little language” notable for its probabilistic jump.
  • FOLDOC and esolangs.org, which both have entries on it. Esolangs.org files it under 1994.

English Wikipedia’s article was deleted after a deletion discussion in July 2014, and a later recreation was removed in 2018. Swedish Wikipedia still has an article that treats the language as probably fictional.

Why It Matters

Kvikkalkul is unusual among joke languages because it is presented as history. Most esoteric languages, such as INTERCAL, Brainfuck and Befunge, are openly fake. Kvikkalkul instead came as a first-person account from a programmer who had supposedly been there, and it is full of convincing period detail: Baudot figures-shift, one’s-complement fractions, paper tape in six colours, and supervisors checking every listing because compiler runs were expensive. That detail made it believable enough that people argued about whether it was real, and complete enough that Asher Hoskins could write a working compiler from the posting alone within a month.

It also says something real about early programming. Fixed-point fractional arithmetic, calling conventions passed through registers, initialization dumps and strict code review all existed on real machines of the 1950s. Kvikkalkul exaggerates them, but it is built from those real practices.

Timeline

1994
20 October: an anonymous poster using the Finnish anon.penet.fi remailer publishes "REPOST: kvikkalkul" to alt.folklore.computers, describing a language supposedly used on Swedish Navy submarine computers in 1957
1994
27 October: a second posting, "More factoids about kvikkalkul", adds the probabilistic jump, the Plankalkul pun and the colour-coded paper tapes
1994
November: Asher Hoskins releases kvik, a Kvikkalkul-to-C translator tested on SunOS 4, calling the original posting "probably a troll"
1994
2 December: a PowerMac port of the kvik translator is released from Boston College
1995
1 April: an April Fool's announcement of an object-oriented "KvikKalkul '95" and a "Visual KvikKalkul" circulates
1997
Rogers Cadenhead's Kvikkalkul home page, collecting the postings and implementations, is featured as an example site in his book Teach Yourself to Create a Home Page in 24 Hours
1998
FOLDOC's Kvikkalkul entry is last updated (14 November), describing it as a deliberately cryptic language whose authenticity is an open question
2014
English Wikipedia's Kvikkalkul article is deleted after a second deletion discussion (7 July)

Notable Uses & Legacy

kvik (Asher Hoskins)

A 1994 compiler that translates Kvikkalkul source into C, shipped with sample programs, a grammar, a Baudot table and the full library routine list - the implementation that turned a Usenet story into something that could actually run

Kvikkalkul for PowerMac

A December 1994 port of the kvik translator to the Power Macintosh, distributed from Boston College

Retrocomputing Museum

Eric S. Raymond's Retrocomputing Museum lists Kvikkalkul among its odd languages, noting its probabilistic jump, and hosts a downloadable archive

Teach Yourself to Create a Home Page in 24 Hours

Rogers Cadenhead's Kvikkalkul home page, which preserves the original postings, the example program and both translators, was featured in his 1997 Sams tutorial book

FOLDOC

The Free On-line Dictionary of Computing carries an entry on Kvikkalkul, comparing it to INTERCAL and highlighting its digit-only names and missing comments

Running Today

Run examples using the official Docker image:

docker pull
Last updated: