Full 0

From Esolang
Jump to navigation Jump to search

Full 0 (pronounced Full Circle or Full Oh) is an Esoteric Programming Language devised by Tslil Clingman in late 2007. Full 0 encompassed the author's wishes for a language with a minimal set of commands, but many possible instructions. This was achieved through the unique implementation of a command list and modifiers in the language.

Language Overview

Full 0 comprises a list of seven commands and a command pointer moving in a direction along the list. Various arguments may be parsed to each command and the pointer may be manipulated through various means, and after each call to a command, the command pointer is advanced by one place in the current direction. There are also 26,000 variables available for use.

The reserved characters are:

  • All lowercase characters a...z - enclosed in brackets
  • All brackets ( ) [ ] { }
  • At signs, dollar signs, exclamation and question marks and tildes (@$!?~)

Any symbol not enclosed by brackets that is not a reserved character is considered a comment

Command-blocks

In this language, there are four different kinds of command-blocks:

  • {x} : Shift command pointer by x places in current direction
  • ~ : Reverse direction of command pointer
  • @ : Reset command pointer to zero and default direction
  • [x] : Call current command under command pointer with argument x

Only the square brackets initiate a command from the command list, all the others manipulate the list and thus only square brackets advance the command pointer by one place in the current direction. Each one of the above counts as a command-block but enclosing round brackets do not. When a command-block contains further command-blocks (as is the case with the If command-block), it is referred to as a super-block and as such will only advance the command pointer in the current direction by one place if its sub-command-blocks fail to be executed (once more in the case of an If command-block).

Command List

Whenever square brackets are opened, the current instruction pointed to by the command pointer will be executed with the arguments contained within the square brackets. The command list is wrap-around, which means that if you advance the command pointer past either edge of the list, the command pointer will jump either to the top or bottom of the list, depending on its direction and previous location.

  • Inc
  • Dec
  • Jmp
  • Out
  • In
  • If
  • Var

Command Overview

Inc: Increases the value of the variable parsed to the command by one, in the form of a Full 0 Variable name (see below) e.g. [a0] and [z5]


Dec: Decreases the value of the variable parsed to the command by one, in the form of a Full 0 Variable name (see below) e.g. [a0] and [z5]


Jmp: Jumps backwards or forwards to the command-block or super-block number corresponding to the argument parsed to the command. There are two types of jumps available in Full 0:

  • Literal Jumps
  • Relative Jumps


Literal Jumps order a jump to a specific command-block irrespective of where the jump occurs with reference to the jump destination. Literal Jumps are called using [x] where x is the absolute value of the command-block number. Relative Jumps order a jump to a destination relative to the current command-block number. Relative Jumps are called using [!+x] where x is a positive or negative integer and "!" is the current command-block number (inclusive of the jump command-block).

Both jump types however, are subjected to the same rule when jumping. The jump destination will always be at the end of the command-block. Therefore, in the series ~@[x][J], if [J] were a jump command and J itself were -1, a jump would be made to the beginning of the code (prior to the first instruction) but if J itself were 2, a jump would be made to the end of the [x] block and thus execute [J] again, creating an infinite loop. The same applies to Relative Jumps using "!".

NOTE:

  • a. A Full 0 variable may also be utilized as a jump argument (in both the Relative and Literal forms). However, if a jump argument points to a destination beyond the end of the code, the destination is defaulted to -1 (the very first instruction).
  • b. It is impossible to jump to the end of a super-block in Full 0, instead what will happened is that a jump will be made to the last instruction of the super-block encompassing the jump destination, thus essentially jumping to the end of a super-block.


Out: Outputs a character from the variable specified in the call to the function. It only outputs characters from variables using the ASCII translation, and thus the value of the variable must be in the range of 0 to 255 (inclusive). Otherwise the call is ignored. e.g. [a0]. The value of a variable may also be directly output by calling the Out command using [#Variable], and Full 0 will print the value of the variable ignoring all ASCII-related translations and restrictions e.g. [#a0]


Inp: Receives a single character read from the input and stores the ASCII value of the input in the variable called as the argument e.g. [a0]


If: Compares two values supplied in the argument with the comparison specified using one of the following:

>  : Greater than

=  : Equal to

/> : Not greater than

/= : Not equal to

If the argument evaluates to be true, the second argument is executed. There is no "else" or "else if", that will have to be synthesised using multiple If's and Jumps. The syntax for If would be [(argument)(true evaluation)]. The argument phrase, enclosed in a set of round brackets, is not counted as a command-block and may only consist of two values separated by an expression. The true evaluation phrase, enclosed in a set of round brackets, may consist of any mixture of further command-blocks and or super-blocks and each of its command-blocks is counted respectively (individually). The whole If block is not counted as a command-block. Rather it is simply referred to as a "super-block". However, the true evaluation sub-blocks are counted as command-blocks. It is therefore possible for a jump to point to a destination within a true evaluation phrase.

e.g. [(a5>b4)([x]{y}@~)] is counted as having four command-blocks only. 

NOTE: Even though an If block is referred to as a super-block, should the true evaluation phrase not be executed, the command pointer will still be advanced by one place in the current direction. Thus it is advisable to utilise '@' signs at he beginning of a true evaluation block and at the end of an If super-block.


Var: Enables the assigning of values directly to variables. It accepts two arguments as follows: [(Q)(M)]. Q represents the desired variable name and in Full 0 can be any single lowercase character followed by any digit between 0 and 999 (inclusive) resulting in 26,000 possible variables. M represents the value that is assigned to the variable. It can be one of three things:

  • an integer
  • another variable, or
  • any single literal character.


If a literal character is chosen, then it needs to be preceded by a "?".The ASCII value of that character is then assigned to the variable. A variable call is counted as a single command-block only. e.g. [(a0)(10)] and [(f612)(?P)]

There is, however, another, more dynamic way of declaring variables in Full 0, that can enable any given programme to simulate a tape or array. It works as follows: In order to declare a variable using a variable in Full 0, we call [($y$z)(x)], where $y is a variable containing the ASCII value for a lower-case character between a and z (normal range, inclusive) and $z is a variable containing the decimal value of an integer between 0 and 999 (normal range, inclusive). This allows us to allocate unknown or unspecified amounts of variables with arbitrary names. This method may be combined in any way with half a regular call to Var e.g. [(d$a3)(x)] which would assign x to the variable dZ, where Z is the value stored in a3. This format may also be extended to every other function that would accept a variable under normal conditions.

NOTE:

  • a. Storing an out-of-range character or number in the declaration of a variable will cause the programme to crash.
  • b. The "$" of the variable declaration and accessing is not to be confused with the "#" of outputting the value of a variable directly, avoiding ASCII translation.
  • In order to output the value of the variable pointed to by a0 and a1 directly, you may also do the following: [#$a0$a1]

Example Programmes

Hello world

{6}[(a0)(?H)]{3}[a0]{2}[(a0)(?e)]{3}[a0]
{2}[(a0)(?l)]{3}[a0]~{1}[a0]~{4}[(a0)(?o)]
{3}[a0]{2}[(a0)(?,)]{3}[a0]{2}[(a0)(? )]
{3}[a0]{2}[(a0)(?w)]{3}[a0]{2}[(a0)(?o)]
{3}[a0]{2}[(a0)(?r)]{3}[a0]{2}[(a0)(?l)]
{3}[a0]{2}[(a0)(?d)]{3}[a0]{2}[(a0)(?!)]
{3}[a0]

Cat

@{4}[k1][(k1/=10)(~{2}[k1][-1])]

Multiplication

{6}[(a0)(3)]~{1}[(a1)(4)]~{1}[(a3)(a1)]
@{5}[(a0>0)(@@{5}[(a1>0)(@[a2][a1][!-6])][(a1)(a3)]{1}[a0][!-13])]{4}[#a2]

Division with remainder

{6}[(a0)(12)]~{1}[(a1)(5)]~{1}[(a2)(a1)]
@{5}[(a1/>a0)(@@{5}[(a1>0)({3}[a0]~{1}[a1]~{2}[!-10])][(a1)(a2)][a3]{1}[8])]
[(a4)(?r)]~{1}[(a5)(? )]~{5}[#a3]~{1}[a5]~{1}[a4]~{1}[a5]~{1}[#a0]

Fibonacci sequence

{6}[(a0)(13)]~{1}[(a2)(1)]~{1}[(a5)(? )]@{5}[(a0>0)({1}[(a3)(a1)]~{1}[(a4)(a2)]
@{5}[(a3>0)({2}[a4][a3][!-6])][(a2)(a4)]~{1}[(a3)(a1)]@{5}[(a3>0)({3}[a3]~{1}
[a4]~{2}[!-10])][(a1)(a4)]{1}[a0]{1}[#a2]~{1}[a5][8])]

Collatz sequence

@{6}[(a0)(11)]~{1}[(a3)(? )]@{6}[(a1)(a0)]~{4}[#a0]~{1}[a3]@{5}
[(2/>a1)({3}[a1]~{1}[a1]~{2}[!-10])]@{5}[(a1=0)({4}[!+2])]{3}[!+18]{3}
[(a1)(a0)]~{1}[(a0)(0)]@{5}[(2/>a1)(@[a0][a1]~{1}[a1]~{2}[!-11])]{3}[6]
@{6}[(a1)(a0)]~{1}[(a2)(a0)]@{5}[(a1>0)(@[a0][a1][!-6])]@{5}
[(a2>0)(@[a0][a2][!-6])]{1}[a0]{1}[6]

BF Interpreter

A BF interpreter in Full 0, suggesting Turing Completeness:

{6}[(a0)(?a)]{6}[(a1)(7)]@{4}[$a0$a1][($a0$a1/=?!)({2}[a1]{4}[(a1>999)({1}
[(a1)(0)][a0])]@{2}[4])][($a0$a1)(-1)][a1]{4}[(a1>999)({1}[(a1)(0)][a0])]@{6}
[(a2)(a0)]{6}[(a3)(a1)]{6}[(a4)(a0)]{6}[(a5)(a1)]{6}[(a0)(?a)]{6}[(a1)(6)]@[a1]@
{5}[(a1>999)({1}[(a1)(0)][a0])]@{5}[(a5>999)({1}[(a5)(0)][a4]{4}[(a4>?z)({1}
[(a4)(a2)]{6}[(a5)(a3)])])]@{5}[(a3>a5)([(a4=a2)({1}[(a5)(999)]{6}[(a4)(?z)])])]@
{5}[(a5/>0)({1}[(a5)(999)]{1}[a4])]@{5}[($a4$a5>255)({1}[($a4$a5)(0)])]@{5}
[(0>$a4$a5)({1}[($a4$a5)(255)])]@{5}[(a6=0)(@{5}[($a0$a1=?>)({2}[a5]{1}[35])]
@{5}[($a0$a1=?<)({3}[a5][35])]@{5}[($a0$a1=?+)({2}[$a4$a5]{1}[35])]@{5}
[($a0$a1=?-)({3}[$a4$a5][35])]@{5}[($a0$a1=?.)({5}[$a4$a5]{5}[35])]@{5}
[($a0$a1=?,)({6}[$a4$a5]{4}[35])])]@{5}[($a0$a1=?[)([($a4$a5>0)({4}[35])]
{1}[a6])]@{5}[($a0$a1=?])([(a6>0)({3}[a6][35])]{6}[($a4$a5>0)({2}[a6]@{5}
[(a6>0)({3}[a1]{3}[(0>a1)({1}[(a1)(999)]{1}[a0])]@{5}[($a0$a1=?])({2}[a6])]
@{5}[($a0$a1=?[)({3}[a6])]@{2}[!-21])]{3}[37])]{3}[35])]@{5}[($a0$a1>-1)({4}[35])]

Misc and Links

You can contact the author at: hiato1 [at] gmail [dot] com

The website is here (from the Wayback Machine; retrieved on 10 June 2008).