# )0,1(

Paradigm(s) imperative User:Rphii 2021 Cell-based one-dimensional Unknown Unimplemented brainfuck `.01`

[0,1] or )0,1( is an esoteric programming language created by User:rphii in 2021.

## Motivation

• Concept of infinity within fixed bounds.
• brainfuck-ish but different.
• Interrelation.

## Memory

There is a theoretical infinitely addressible memory space from index 0 to 1, both 0 and 1 inclusive. Note that in this language it is possible for the index to be any real number, hence the name for this language.

## Variables

At each memory index there is a variable whose value ranges from 0 to 1, both 0 and 1 inclusive. This also applies to the indexes that access the values (`i` and `j`).

## Abbreviations

For making explanations easier we'll use some abbreviations.

Abbr. Description
`i` Index 0 (main)
`j` Index 1 (secondary)
`q` 10^q
`jq` `j` multimplied by `q`
`@i` or `@j` Value at `i` or at `j` within memory

### j, q & jq

Below we take a closer look at `j`, `q` and `jq`.

j q jq
`1` `0` `1*10^0 = 1*1` = `1`
`1` `1` `1*10^1 = 1*10` = `10`
`1` `2` `1*10^2 = 1*100` = `100`
`1` ` -1` `1*10^(-1) = 1*0.1` = `0.1`

etc.

## Commands

Command Description
`+` Increment `q`
`-` Decrement `q`
`^` Flip rotation
`~` Swap `i` and `j`
` =` Apply rotation `@i` with magnitude `@j`
`'` Set `i` to `@j`
`"` Set `@j` to `i`
`*` Apply rotation on `i` with magnitude of ```jq ```
`[` If no overflow/underflow occured on last rotation jump past matching `]`
`]` If overflow/underflow occured on last rotation jump back to matching `[`
`.` Output character of the rounded reciprocal `@i`
`,` Input character and store reciprocal value `@i`

### Command: `.`

Say that we have a value of `0.0139` stored `@i`. The `.` command first creates the reciprocal value of `@i`, in this case `1/0.0139 = 71.9424`. This value then gets rounded to `72` and printed as a character, which, according to an ASCII table, corresponds to an `H`.

### Command: `,`

Say that the user enters an `H`. The `,` command first creates the reciprocal of the ASCII value, in this case `1/72 = 0.013888...` and stores it `@i`

### Command: `^`

With 'changing rotation' is meant either adding or subtracting. When a program starts, it is initially set to addition. Once that command is executed, rotations get set to subtract mode, until that command changes it back to addition mode.

### Illegal operations

If any of the following illegal operations is triggered, the program should stop or else the universe will explode into countless pieces. Stop exploding universes, that's not cool.

• Be careful with outputting a `0` or you'll maybe anger some mathematicians... Just kidding. It is not allowed to (input nor) output a `0` (note that Ascii 0 with the value 48 can be printed, just not plain old 0).

## Initialization

It is mandatory that each language specifies if initialization takes effect and how. In [0,1] everything is defined by the table below.

Variable Initialized Value
`i` `0`
`j` `1`
`q` `0`
`@i` `i` (each memory index initializes its own memory index as a value)

## Limits

Variable Number set Range
`i` real numbers `0...1`
`j` real numbers `0...1`
`q` whole numbers ` -∞...∞`
`@i` real numbers `0...1`

## Overflowing / Underflowing

• The ` =` command rotates `@i` with magnitude `@j`. (Simply put it adds a value onto another value, but this way it may be easier to imagine)
• The `*` command can also rotate numbers.
• The specification within limits tells us that any number should not be smaller than 0 nor larger than 1.

Conclusion: A number could overflow or underflow. If this happens, a number whould be A) larger than one or B) smaller than 0.

• In the case of A) the number automatically gets 1 subtracted until it is smaller than or equal to 1.
• In the case of B) the number automatically gets 1 added, until it is greater than or equal to 0.

The overflow information is stored until another number is rotated.

## Execution

[0,1] is similarly executed like brainfuck, character for character. Any non-command character is simply ignored.

## Examples

### Truth machine

```--**-*^-**~,.=[^=."]
```