Rhotor

Rhotor is an esoteric programming language developed by Jannis Harder in 2006.

Rhotor is a lazy evaluating functional programming language that utilizes pattern matching.

Data types
Rhotor has 3 data types:


 * Functions : Functions have a matching pattern (the function head), the function code (the function body) and an optional failure function (the function footer)
 * Nil : Nil is the only constant in Rhotor.
 * Cons : A cons concatenates two other items. It can be used to build lists or tree structures. As there are no numbers or strings in Rhotor you have to use Cons and Nil to represent them.

Language syntax
Operators with the highest precedence are listed first.


 * : Those signs act as parentheses. Empty parentheses evaluate to Nil.
 * or  : This syntax is used for functions. Functions are right associative. (  is the same as  ). Wrap functions that use the Footer in parentheses.
 * : This is the syntax for concatenation (Cons). Concatenation is right associative.
 * or : This is the syntax for application. It applies function to argument. Application is left associative.
 * : A lowercase word acts as a symbol. Symbols can be defined in a function head and are valid in the body. If you want to redefine a symbol you have to use the  notation.
 * : This redefines a symbol and can only be used in a function head.

Spaces, uppercase letters and periods are equivalent and can be used to separate symbols and comment the code.

Pattern matching
A pattern is build using Nil, cons and symbols. A pattern matches a function if all elements, except symbols, are equal. Symbols act as a wildcard and match anything.

Application rules

 * always evaluates to Nil.
 * evaluates to.
 * evaluates to the body of the function where every symbol in the body is replaced with the value the same symbol in the pattern matched. Symbols that doesn't occur in the pattern aren't replaced.
 * evaluates to Nil.
 * evaluates to.

Data representation
Rhotor specifies data representations for natural numbers and strings. They are not part of the language but of the IO system.

Numbers
Numbers are written as  followed by N times. There is a short cut notation.

Strings
Strings are written as. Again, there is a short cut notation. You may use  for a newline and   for a quote character.

IO system
The program is applied to the user input and the evaluated string is printed to the screen.

Turing completeness proof
Using the following rules, it is possible to transform any lambda calculus expression into an equivalent Rhotor expression.


 * 1) Replace every ( and ) with   and.
 * 2) Replace every &lambda; a . b with

External resources

 * Alternative link from the Esoteric File Archive.
 * Alternative link from the Esoteric File Archive.