The Revomer Programming Language

Reference manual - version 0.9

Krzysztof Piecuch

Tomasz Jędrzejewski


Table of Contents

Preface
1. Concepts
1.1. Sample program
1.2. Details
1.3. Environment
2. Syntax
2.1. Basics
2.2. Functions
2.2.1. Function declaration
2.2.2. almukantarat
2.2.3. conf
2.2.4. rf
2.2.5. charm
2.3. Operators
2.3.1. ????&
2.3.2. in
2.3.3. @&%^"
2.3.4. *?!
2.3.5. ~].?&*
2.4. Source code management
2.4.1. come here
2.4.2. unless
2.4.3. if
2.4.4. real
2.4.5. shuffle
2.5. The program memory
2.5.1. hide
2.5.2. gifs
2.5.3. sars
2.6. Input/output
2.6.1. gifts
2.6.2. pos
2.7. Special commands
2.7.1. nope
2.7.2. rope
3. The rest
3.1. Memory management
3.2. Revomer Logic
3.3. The interpreter
3.4. In the future
A. Ferrinti number system
B. Copyright

List of Tables

2.1. The ????& operator
3.1. The ????& operator
A.1. The base numbers

List of Examples

1.1. "HI UNIVERSE" program
2.1. "HI UNIVERSE" program
2.2. Brackets
2.3. Calling the "foo" function
2.4. Copying
2.5. Random numbers
2.6. Inserting constant values:

Preface

On 28 August 2006, a small group of young mathematics and programmers from Poland arrived to the Stanislaw Staszic High School in Lublin in order to share their knowledge and experience. Just before the meeting started, the talk about esoteric programming languages began. In the opinion of the participants many of them offered nothing more than crazy syntax. On the first lecture, two people, Krzysztof Piecuch and Tomasz Jędrzejewski, decided to create something new and brilliant - a new programming language based on an extraordinary idea of working. That's how the Revomer project started.

During the five days of meeting, in very strange conditions, the first interpreter and the project goals were born. Most of the work took place at night and early morning, on a laptop located in the gymnasium, and the first version of this reference manual was written on a toilet paper. On 1 September, at 10.04 AM we managed to run the program writing "HI UNIVERSE" for the first time.

The name of the language is the English word "Remover" written backwards. It illustrates the basic ideas of the project. They can be described in a short abbreviation IN-IG (Is Negative-Is Good). The structure of the language forces the programmer to use completely new point of view to many of seeming obvious syntax elements and programming practices. We hope our project will be an important milestone for the human IT knowledge, and that it will be bought by the well-known software company from Redmond to include in in its products.

Chapter 1. Concepts

In this chapter we describe the basic concepts of the Revomer Programming Language.

1.1. Sample program

The program shown below is also the first one run on the Revomer Interpreter. It writes the "HI UNIVERSE" text on a screen and stops its work.

Example 1.1. "HI UNIVERSE" program

almukantarat~
nope~
null%
almukantarat~
come here $1, $1, $3
gifs 3~
hide $3
gifs 29~
hide $2
gifs 29~
hide $1
pos $0~
gifs 69~
pos $0~
gifs 83~
pos $0~
gifs 82~
pos $0~
gifs 69~
pos $0~
gifs 86~
pos $0~
gifs 73~
pos $0~
gifs 78~
pos $0~
gifs 85~
pos $0~
gifs 32~
pos $0~
gifs 73~
pos $0~
gifs 72~
hide $0
%	     

A more detailed explaination will be done later.

1.2. Details

Detailed concepts of the Revomer are:

  1. Removing, negation, substraction (and even division!) is good. Addition and the rest is baad.
  2. If we manage to add something, it always cost something, because it is baad.
  3. The execution of the program is based on the self-modification of the program source code.
  4. If the interpreter does not know, what to do, it tries to guess, what the programmer wanted; read: performs a random operation.

1.3. Environment

The environment, where the Revomer programs are executed, consists of the following elements:

  1. Program memory for the program data is built of 1-byte cells that support signed numbers (both positive and negative). The interpreter must give the program at least 64 kB of memory. The memory is randomly-filled at the start of the execution.
  2. Source code memory - its structure depends on the interpreter, but it must allow to modify the sources during the program execution.
  3. The source code is a list of commands for the interpreter. Each command can take up to 4 arguments.
  4. The program memory works also as registers, so the instructions can take only the memory pointers as arguments, which tell, under which cell the required value is stored.
  5. The length of the arguments can be changed during the program execution, in order to allow to give bigger numbers as arguments. The length change also reverses the byte endianess. More details in the memory management chapter.

Chapter 2. Syntax

2.1. Basics

Let's go back to the "HI UNIVERSE" program. We are going to introduce the language, basing on it..

Example 2.1. "HI UNIVERSE" program

almukantarat~
nope~
null%
almukantarat~
come here $1, $1, $3
gifs 3~
hide $3
gifs 29~
hide $2
gifs 29~
hide $1
pos $0~
gifs 69~
pos $0~
gifs 83~
pos $0~
gifs 82~
pos $0~
gifs 69~
pos $0~
gifs 86~
pos $0~
gifs 73~
pos $0~
gifs 78~
pos $0~
gifs 85~
pos $0~
gifs 32~
pos $0~
gifs 73~
pos $0~
gifs 72~
hide $0
%	     

The first and most important rule that you need to learn, is the direction of program execution. Each line contains only one command. The lines are counted from the beginning of the file, but the code is executed from the end (from bottom to top). While describing the commands, we will use the terms "next command" and "previous command" according to the execution direction. Thus, the expression "to delete the next instruction" means the interpreter must delete the instruction that will be executed next, one line higher.

The source code consists of functions. The function declaration begins with the % character, BEFORE which its name is specified. A function without the name is called main function, and it is called on the beginning of the program. Many functions with the same name are allowed - while calling one of them is selected in a random way. The function ends its work, when it reaches the next function declaration or the almukantarat command, and then makes sure it does not contain any commands. Otherwise, it starts its execution again. The program ends at the moment of removing the last line from the used main function.

As we said, the function may end, when reaches the next function declaration or the end of the command list. However, the interpreter does not like, if the programmer wants him to go there - the execution should be terminated with the almukantarat command then (Notice: this command is not counted in the total number of commands in the function), or the program is punished by executing rope (random operation). To sum up, we have two commands in some function: nope and almukantarat. As we said, the second one is not counted, so for the interpreter this function contains only one command. If we delete just nope, the function terminates.

Some other syntax rules:

  1. Every command in Revomer must end with a tilde, except those commands that must not. The exception from the exception is rope, which can be written both with a tilde and without it.
  2. There are no comments in Revomer. Moreover, whitespaces are ignored only at the end of the line. In other places, the number of whitespaces is very important.
  3. The parameter list is separated from the command name with one space.
  4. The parameters are separated with a comma and a space.
  5. A parameter is unsually an address of the memory cell. An address is made of the dollar symbol ($) and the cell number. Revomer allows to use pointers: $$12 means that we keep the address we need in the cell 12. The pointers can be much bigger, for example $$$$$$$$$$$$$$$12. The maximum size of the pointer is 255 symbols of dollar.
  6. Some of the commands are called machine commands and can take other parameter values, than pointers. The allowed values are: a number or a name.
  7. Some of the commands require to specify parameters in brackets. In Revomer, the opening bracket is }, and the closing one is #. Between the brackets and the parameters, there are no spaces. Sample command:

    Example 2.2. Brackets

    unless}$3#

2.2. Functions

This chapter describes the command connected with creating, calling and managing functions.

2.2.1. Function declaration

name%
		

Begins a function with the specified name. If the name is not specified, the main function is created. If the interpreter reaches this line during the exection, it works like almukantarat, but before that the rope command is executed.

This command is not ended with a tilde.

2.2.2. almukantarat

almukantarat~
		

If the currently executed function has no commands, it is terminated and the program returns to the line, where the function was called. Otherwise, the function is executed again. The name of this command means "Almucantar" in Polish, which is an astronomy term (a circle on the celestial sphere parallel to the horizon).

2.2.3. conf

conf function1, function2~
		

Replaces two functions with the names. The operation affects also the functions that are already in the stack. The command is ended with a tilde.

2.2.4. rf

rf function~
		

Removes from the code all the functions with the specified name. If we try to remove the main function, it does not stop the program! If the program does not have any main function, the interpreter starts to repeat the rope operation, hoping that one day it will manage to recreate the main function. The command is ended with a tilde.

2.2.5. charm

charm $1
		

Calls the function. The function name must be put lowering into the memory cells, starting from $1. The only parameter is the address of the cell that contains the first letter of the name. The algorithm that reads the function name:

  1. Take a char from the current cell and add it to the buffer.
  2. Is there a function with the name that we keep in the buffer?
  3. If yes, stop and call it..
  4. If no, move to the previous memory cell and jump to 1.

If the interpreter reaches the end of the memory, it performs the rope operation.

Example 2.3. Calling the "foo" function

almukantarat~
nope~
foo%
almukantarat~
charm $2
gifs 111~
hide $0
gifs 111~
hide $1
gifs 102~
hide $2
%	     

2.3. Operators

This chapter describes the operators available in Revomer.

2.3.1. ????&

????& $1, $2
		 

The Revomer Logic Operator performs the operation on the $1 and $2 parameters and saves the result to the first one. The logical table:

Table 2.1. The ????& operator

The ????& operator
$1$1 ????& $2$2
0-10
0-1-1
-1-10
-10-1

The values other than Revomeric True and False are reducted to them with the Standard Reductor..

2.3.2. in

in $1
		 

The IN Reductor - if there is a negative value in the specified memory cell, it saves there the Revomeric True (-1). For positive values - Revomeric False (0).

2.3.3. @&%^"

@&%^" $1, $2
         

Substracts the second parameter from the first and saves the result in the memory cell specified in the second one.

2.3.4. *?!

*?! $1, $2
         

Divides the first parameter by the second and saves the result in the memory cell specified in the first one. When division by 0 occurs, it performs rope.

2.3.5. ~].?&*

~].?&* $1, $2~
         

Copies the content of the first cell to the second. In the example below, we first insert the value 52 to the $8 cell and then copy it to $9.

Example 2.4. Copying

almukantarat~
nope~
null%
almukantarat~
come here $0, $0, $1
gifs 3~
hide $1
gifs 8~
hide $0
pos $9~
~].?&* $8, $9~
gifs 66~
hide $8
%	     

The command must be ended with a tilde..

2.4. Source code management

This chapter describes the commands that allow the source code management.

2.4.1. come here

come here $1[, $2[, $3]]
         

Moves the parts of the source code from one place to another. The exact action depends on the number of parameters:

  1. Takes the command lying $1 and moves it before the "come here".
  2. Two parameters allow to define the whole group of commands to move before the "come here". The first one tells to go X lines to the bottom (the beginning of the selected area), and then $2 lines to the top (the end of the selected area). The group is moved right before the come here.
  3. Third parameter allows to specify other place to move the group to, starting from come here (line numbers counted from the top).

Warning: if the new localization of a command group is inside ythis group, it causes the defragmentation of the source code! The behaviour of the command cursor is the following: by default, the next command to execute lies after come here. However, if come here moves also itself, we jump to the command after the moved group.

2.4.2. unless

unless}$1#
         

The conditional code removing. If there is a Revomeric False in the specified memory cell, the next command in the source code is removed. The memory cell address is typed inside brackets.

2.4.3. if

if $1, $2~
         

Includes the Revomer file, whose name is specified between the memory cells $1 and $2. The contents of the file are included in the place of the if command, which is removed. The execution starts from the line-before-the-last in the included file.

2.4.4. real

real $1~
         

Removes the line that lies $1 lines below.

2.4.5. shuffle

shuffle $1, $2
         

Shuffles the source code between the lines $1 and $2 to the top. An example: random numbers from 1 to 10.

Example 2.5. Random numbers

almukantarat~
nope~
null%
almukantarat~
come here $2, $2, $4
gifs 3~
hide $4
gifs 21~
hide $2
pos $0~
gifs 74~
gifs 73~
gifs 72~
gifs 71~
gifs 70~
gifs 69~
gifs 68~
gifs 67~
gifs 66~
gifs 65~
shuffle $1, $2
hide $0
gifs 1~
hide $1
gifs 11~
hide $2
%	     

In the example, we chose to mix the lines from 1 to 11 above the shuffle.

2.5. The program memory

This chapter describes the memory management commands.

2.5.1. hide

hide $1
         
Moves the interpreter pointer to the specified memory cell. We do not write a tilde after it.

2.5.2. gifs

gifs value~
         
Puts the specified positive number to the memory cell pointed by the interpreter pointer. The code below puts the number "20" to the memory cell $0:

Example 2.6. Inserting constant values:

gifs 20~
hide $0	     

2.5.3. sars

sars 1|2|4
         

Changes the length of the parameters passed to commands. The acceptable lengths are 1, 2 or 4 bytes. Moreover, the call of sars changes the endianess. The memory pointers always point the highest byte.If the interpreter works in big endian, the rest of the bytes is read from the cells with incrementing number. For little endian - the addresses decrement.

2.6. Input/output

Input/output commands.

2.6.1. gifts

gifts $1[, $2]
         

The input command, writes the entered character/number to the specified memory cell. Depending on the second parameter:

  • If there is a negative value - we can type the number manually in the system console. The sars affects this workmode, so we can type even big integers.
  • For 0 and positives: the code of the typed char is saved in the memory cell.

2.6.2. pos

pos $1~
         

Prints the ASCII char with the code specified in the parameter. The positive values are treated normally, and the negative numbers allow to print the characters with the codes from 128 to 255 using the formula (-X+127).

2.7. Special commands

Additional commands that need special attention.

2.7.1. nope

nope~
         

This command does nothing.

2.7.2. rope

rope~
         

Performs a random operation with random arguments. rope is really important for the Revomer Programming Language, because it allows to guess, what the programmer wanted to do, for example by making a syntax error. So, rope is called after every unexpected situation. It is the only command that can, but does not have to be ended with a tilde.

rope can also generate functions. If the main function is generated, and there is no main function in the code, the interpreter jumps to this function.

Chapter 3. The rest

3.1. Memory management

Some additional information about the memory and storing data in Revomer.

  1. For storing the negative numbers, Revomer uses the two's complement.
  2. The negative number represents the ASCII char with the code -X + 128, where X is the value.
  3. The endianess and storing the numbers bigger than 8-bit (and the possibility to use them, at all) depends on the sars settings. The endianess changes every call of this command. The default endianess is big endian.
  4. Revomer supports the following logical values: Revomeric True (-1) and Revomeric False (0). Any other value can be reducted to the logical value using the Standard Reductor.

3.2. Revomer Logic

This chapter describes the logical system used by Revomer. It is very similar to the classical model, but there are some important details which should be kept in mind.

The Revomer Logic uses two logical values: Revomeric False (0) and Revomeric True (-1), which has a negative value.

The Revomer Logic has only one logical operator: ????& and two reductors that allow to convert any other value to the Revomeric True or False. The operator ????& gives the following result:

Table 3.1. The ????& operator

The ????& operator
$1$1 ????& $2$2
0-10
0-1-1
-1-10
-10-1

It is similar to the NAND operator in the classical logic.

The Standard Reductor is used by default to conversion to the logical values. Here is its algorithm:

  1. Write the number in the Ferrinti constructed language (without the diactrical marks). The grammar of Ferrinti is unfortunately available only in Polish (there is too much to translate :)), but if you know this language, you can find in under yermenia.zyxist.com/ferrincki.html. For the rest of the world, we translated only the chapter about the numbers.
  2. Hash the string with MD5.
  3. Take 3rd bit of the 17th byte and change it from 1 to -1, if there is such need.

The second reductor is called IN (Is Negative). It converts all the negative numbers to the Revomeric True and the rest to the Revomeric False.

3.3. The interpreter

Some tips, how the intepreter should work.

  1. In case of not-finding the main function, the intepreter repeats the rope operation, hoping that one day it will create a main function, which could be executed. So, in Revomer, it is the easiest to write a program that generates other programs - just pass an empty file to execute.
  2. The conf command causes the replacement of the function names, but not their starting points and other features. The stack keeps only the called function names, so if we start to execute "foo", then replace its name with "bar", then "foo" gets the features of "bar": its length, localization, etc.
  3. If we somehow manage to remove the currently executed command, we have to move the cursor to the command that should be normally performed next.

3.4. In the future

That's not all! In the future versions, the Revomer Programming Language will have a lot of new features:

  1. File support.
  2. Network Source Code Transmission Protocol - communicate with other Revomer programs over the Internet by sharing the source code!
  3. System console support - the apps could have a simple interface.
  4. Multiexceptioning - a revolutionary connection of multitasking and exceptions!
  5. Elements of RPG.
  6. Standard Useless Function Library
  7. More memory = more problems = more fun.

The changes will be compatible with the reference you have already read.

Appendix A. Ferrinti number system

For those who do not know Polish, we translated also a part of the Ferrinti language grammar concerning numbers.

Table A.1. The base numbers

The base numbers
NumberCardinalOrdinalNumber name
0nŭlquerilnŭl
1quantaquantilquatte
2dwadualdutte
3thritrildutte
4vartavarialvarte
5pestpestalpette
6sektsektalsĕkte
7sevainsevilsevte
8ervenervilerve
9nŭnanŭnilnŭtte
10tæntæniltætte
11elvainelvainelvatte
12dhezadhezindette
100centeincentilcentrĕ
1000tuzentuzal-
1000000millionmillial-
1000000000milliardmirdial-

Creating compound numbers:

  • 13 - 19: to the base number we add the ending -ttes: erventtes "18". Watch out for 15 and 16! Their forms are "pesttes" and "sekttes" (double, not triple "t")!
  • Numbers 20, 30... up to 90: to the base number we add the cardinal form of "10". Example: dwatæn "20".
  • 21-29, 31-39 to 91-99: to the multiple of 10 we add the base and separate it by the pause: dwatæn-pest "25".
  • Numbers 200, 300.. to 900: we add the -cent ending to the base number.
  • 101-199, etc: use the rules above and precede the number by the multiply of 100: dwacent pestæn-thri "253".
  • Numbers 2000, 3000 etc.: before the number "1000" (tuzen). If there is more than one thousand, we precede the word "tuzen" by its number: varta tuzen sektcent thritæn-nŭna "4639".

And so on to billions.

For Revomer, use "e" for "ĕ", "u" for "ŭ" and "ae" for "æ"

Appendix B. Copyright

The authors of the Revomer Programming Language and the reference manual are Krzysztof Piecuch and Tomasz Jędrzejewski. It will be they, who the world will thank to, if the well-known software company from Redmond REALLY buys the project.