¤0815

0815 - Language details

0815 is based around a queue and 3 registers. It understands hexadecimals only, so every numeric input and output are in hexadecimals. It also ignores everything that is not one of its instructions, for that matter: everything that is not an instruction is a comment.

Registers

0815 has 3 signed integers 64 bit wide registers: X, Y, and Z. All three are initialized with 0. X is a write only register and Z is a read only register. Y is a helper register and cannot be accessed by the programmer.

Parameters

Some of 0815 instructions need parameters. All parameters must be surrounded by colons, e.g. :3c:
Labels are also considered parameters; therefore they also need the surrounding colons.
If a parameter is needed but any is found the instruction will simply be ignored, no error message will be displayed.

Jumps

In 0815 you find 2 kinds of jumps: if Zero( # ) or if not Zero( ^ ). Jumps' labels can contain any character, except the language reserved symbols, e.g. :_loop: or :34:
If the label that the jump is pointed to is not found, the program terminates.

New lines

Either ASCII 10 or 13 will be interpreted as a new line.

Instructions

+-----------+---------+---------------------------------------------------------------------------+
|           |         |<:2: will move '2' to register X                                           |
|   move    |    <    |(parameter is mandatory)                                                   |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|           |         |swaps register X and Y                                                     |
|   swap    |    x    |                                                                           |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|           |         |}:_loop: this creates a label called '_loop'                               |
|   label   |    }    |(parameter is mandatory)                                                   |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|   input   |         |inputs a signed 64 bit integer and stores it into X                        |
|   number  |    |    |(hexadecimal base)                                                         |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|   input   |         |inputs an ASCII char and stores it into X                                  |
|   ASCII   |    !    |                                                                           |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|   print   |         |prints a signed 64 bit integer stored in Z                                 |
|   number  |    %    |(hexadecimal base)                                                         |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|   print   |         |prints an ASCII char stored in Z                                           |
|   ASCII   |    $    |                                                                           |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|   roll    |         |rolls all registers to the left: X <- Y <- Z                               |
| registers |    ~    |after roll: X = Y, Y = Z and Z = X                                         |
|   left    |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|   roll    |         |rolls all registers to the right: X -> Y -> Z                              |
| registers |    =    |after roll: X = Z, Y = X and Z = Y                                         |
|  right    |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|   jump    |         |^:_loop: jumps to label _loop if Z is not 0                                |
|   if not  |    ^    |(parameter is mandatory)                                                   |
|   zero    |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|   jump    |         |#:_loop: jumps to label _loop if Z is 0                                    |
|   if      |    #    |(parameter is mandatory)                                                   |
|   zero    |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+

Queue instructions

+-----------+---------+---------------------------------------------------------------------------+
|           |         |clears the queue                                                           |
|  clear    |    ?    |                                                                           |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|           |         |enqueue the number stored in Z                                             |
|  enqueue  |    >    |                                                                           |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|           |         |dequeue a number and stores it into X                                      |
|  dequeue  |    {    |                                                                           |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|   roll    |         |rolls the queue to the left: the first value becomes the last, the second  |
|   queue   |    @    |will be first and so on. If no parameter is found, it will roll the queue  |
|   left    |         |once, otherwise rolls it parameter times. e.g. @:a: rolls the queue ten    |
|           |         |times to the left.                                                         |
+-----------+---------+---------------------------------------------------------------------------+
|  roll     |         |the same as '@' just that the roll will go to the right:                   |
|  queue    |    &    |the last will be the first, the first will be the second and so on.        |
|  right    |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+

Arithmetic instructions

+-----------+---------+---------------------------------------------------------------------------+
|           |         |Z = X + Y                                                                  |
|   add     |    +    |                                                                           |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|           |         |Z = X - Y                                                                  |
|   sub     |    -    |                                                                           |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|           |         |Z = X * Y                                                                  |
| multipl.  |    *    |                                                                           |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+
|           |         |Z = X / Y                                                                  |
| division  |    /    |Y = rest                                                                   |
|           |         |                                                                           |
+-----------+---------+---------------------------------------------------------------------------+

Interpreter

I re-wrote my Brainfuck interpreter to run 0815 programs. This version just runs (interprets) 0815 programs.
Probably, I'll write another version that can interpret both languages, but for now, this will do.
There is another issue that I should mention: In this version, the Queue will only show its first 2070 items.
0815 Interpreter

0815 Programming examples

 
Home | Esolang
 

Last updated: Wednesday, 24 August 2016 - 11:39:58
©2004 - 2016 Paulo Jorente
Impressum | xhtml | css | cc