RK 1.2 is a compact, block-structured high-level programming language designed by Reynold Kenny in 1972. It is an original language in the spirit of the small systems languages of that period: explicit types, uppercase keywords, fixed-size arrays, value parameters and a small, readable grammar. This release extends the original design with floating-point values, constants, additional loop forms, a CASE statement and a library of built-in numeric and string functions.
The language is described completely in the Language Reference. The formal grammar is in the Formal Grammar.
A First RK Program
PROGRAM "CALCULATOR" {
REAL A := 12.5
REAL B := 30.0
REAL RESULT := A + B
PRINT RESULT
}
FINISH
Language at a Glance
PROGRAM "NAME" { ... } FINISHencloses the main program.PROCEDURE NAME[REAL A, STRING S] { ... }declares a procedure.INTEGER,REAL,CHARACTERandSTRINGare the value types.:=initialises a declaration;SETassigns to an existing variable.CONSTANT INTEGER N := 10declares a read-only value.WHEN [condition] { ... } OTHERWISE { ... }selects a branch.REPEAT { ... } UNTIL [condition]repeats after testing.WHILE [condition] { ... }repeats before testing.FOR I FROM 1 TO 10 STEP 2 { ... }counts through a range.BREAKandCONTINUEcontrol loop execution.CASE X { OF 1 { ... } DEFAULT { ... } }selects by value.PRINTwrites a line;ACCEPTreads a line;RETURNleaves a procedure.- Built-ins include ABS, MIN, MAX, SQRT, POW, ROUND, FLOOR, CEIL,
TRUNC, SGN, PI, LEN, UPPER, LOWER, LEFT, RIGHT, MID, FIND, CHR,
CODE, TEXT and NUMBER. All are called with brackets, as in
SQRT[9]. [...]delimits conditions, parameter lists, argument lists, array sizes, string capacities and array subscripts./* ... */introduces a comment.- Statements are separated by newlines or optional semicolons.
The Example Program
The original distribution included example.rk, an interactive
four-function calculator with integer choice selection, REAL arithmetic,
POWER, SQUARE ROOT, division-by-zero checking and a repeating menu. It
exercises constants, procedures, REAL values, CASE, REPEAT, BREAK,
WHEN/OTHERWISE and the POW and SQRT built-ins in one small program.
Design Identity
RK is not a renamed B, C, BASIC or Pascal. Its uppercase command vocabulary, SET assignment, WHEN/OTHERWISE selection, REPEAT/UNTIL loop, FOR/FROM/TO counted loop and CASE/OF selection give it a separate visual and syntactic identity. The bracketed forms are not decoration: each use is defined in the grammar and corresponds to a distinct syntactic position.
Historical Notes
The interpreter was deliberately written in the style of early-1970s C:
K&R-style function definitions, declarations at the beginning of a
block, fixed-size tables and /* ... */ comments only. The code
cannot claim compatibility with one exact 1972 C dialect. A small number
of accommodations are confined to the build and the library interface on
modern systems.
The source code is not published. It remains in a private archive and is not available for copying or redistribution. See the License.