Navrytl

From Esolang
Jump to navigation Jump to search

Navrytl is designed by PSTF.

It is Brainfuck equivalent in Timeline 284436. In that universe, it is designed by Maiquel Quehuacetzel, is also a big fan of Aztec culture. His real name is Mike Quitrys.

Overview

Navrytl(in fact it should be nahuitl but Mike made a joke in the name) operates on a stack, a register and an array that is folded.

It looks really like Assembly language.

Command Table
Command Description
FWD x Point the pointer to the next xth cell.
BKD x Point the pointer to the previous xth cell.
ADD x Add x to the data in the current cell.
SUB x Subtract x from the data in the current cell.
MUL x Multiply the data in the current cell by x.
DIV x Divide the data in the current cell by x, result is rounded towards 0.
MOD x Divide the data in the current cell by x, result in remainder.
GET Read a decimal integer from CON and store it into the current cell. If other characters are encountered, only the part before the character will be read. Leading zeros will be ignored.
PUT Output the data of the current cell as an integer to CON.
REA Read a character from the CON and store it in the current cell.
WRT Output the current cell as a Unicode character. If the data in the current cell corresponds to an invalid code point, do nothing.
JMP x Jump to the specified label without any checks.
LOOP If the data in the current cell is 0, then jump to the command immediately following the nearest ENDL.
ENDL If the data in the current cell is not 0, then jump to the nearest LOOP.
HLT Halt.
PUSH The top of the stack becomes the data of the current cell, the stack pointer moves up one position, and the current cell is cleared.
POP The current cell data becomes the top of the stack, the stack pointer moves down one position, and the top of the stack is discarded.
LET Transfer the data from the current cell to the accumulator. Accumulator is AC and stack top is ST.
SET Transfer the data from the accumulator to the current cell.

Variation 1

Command Table
Command Description
>x Point the pointer to the next xth cell.
<x Point the pointer to the previous xth cell.
+x Add x to the data in the current cell.
-x Subtract x from the data in the current cell.
*x Multiply the data in the current cell by x.
`x Divide the data in the current cell by x, result is rounded towards 0.
%x Divide the data in the current cell by x, result in remainder.
; Read a decimal integer from CON and store it into the current cell. If other characters are encountered, only the part before the character will be read. Leading zeros will be ignored.
: Output the data of the current cell as an integer to CON.
, Read a character from the CON and store it in the current cell.
. Output the current cell as a Unicode character. If the data in the current cell corresponds to an invalid code point, do nothing.
$x Jump to the specified label without any checks.
[ If the data in the current cell is 0, then jump to the command immediately following the nearest ENDL.
] If the data in the current cell is not 0, then jump to the nearest LOOP.
@ Halt.
( The top of the stack becomes the data of the current cell, the stack pointer moves up one position, and the current cell is cleared.
) The current cell data becomes the top of the stack, the stack pointer moves down one position, and the top of the stack is discarded.
/ Transfer the data from the current cell to the accumulator. Accumulator is AC and stack top is ST.
\ Transfer the data from the accumulator to the current cell.
{ Skip all content inside the curly braces. Must match } strictly.
~ Define a label. Must match ! strictly.

Variation 2

Command Table
Command Description
> Point the pointer to the next cell.
< Point the pointer to the previous cell.
+ Add 1 to the data in the current cell.
- Subtract 1 from the data in the current cell.
* Multiply the data in the current cell by accumulator.
` Divide the data in the current cell by accumulator, result is rounded towards 0.
% Divide the data in the current cell by accumulator, result in remainder.
; Read a decimal integer from CON and store it into the current cell. If other characters are encountered, only the part before the character will be read. Leading zeros will be ignored.
: Output the data of the current cell as an integer to CON.
, Read a character from the CON and store it in the current cell.
. Output the current cell as a Unicode character. If the data in the current cell corresponds to an invalid code point, do nothing.
$x Jump to the specified label without any checks.
[ If the data in the current cell is 0, then jump to the command immediately following the nearest ENDL.
] If the data in the current cell is not 0, then jump to the nearest LOOP.
@ Halt.
( The top of the stack becomes the data of the current cell, the stack pointer moves up one position, and the current cell is cleared.
) The current cell data becomes the top of the stack, the stack pointer moves down one position, and the top of the stack is discarded.
/ Transfer the data from the current cell to the accumulator.
\ Transfer the data from the accumulator to the current cell.
{ Skip all content inside the curly braces. Must match } strictly.=
~ Define a label. Must match ! strictly.

Matrix variation

In the matrix variant, we replaced the one-dimensional tape with an array composed of five such tapes. We can assume that both dimensions are wrapped around, meaning that the next tape after the fifth tape is the first tape, and the next cell after the last cell is the first cell, and so on, just like storing data in a donut-shaped "data storage structure."

Command Table
Command Description
FWD x Point the pointer to the next xth cell.
BKD x Point the pointer to the previous xth cell.
CHG x Switch to tape number x. The pointer position remains unchanged. We can assume that the pointers of the five tapes are tied together.
ADD x Add x to the data in the current cell.
SUB x Subtract x from the data in the current cell.
MUL x Multiply the data in the current cell by x.
DIV x Divide the data in the current cell by x, result is rounded towards 0.
MOD x Divide the data in the current cell by x, result in remainder.
GET Read a decimal integer from CON and store it into the current cell. If other characters are encountered, only the part before the character will be read. Leading zeros will be ignored.
PUT Output the data of the current cell as an integer to CON.
REA Read a character from the CON and store it in the current cell.
WRT Output the current cell as a Unicode character. If the data in the current cell corresponds to an invalid code point, do nothing.
JMP x Jump to the specified label without any checks.
LOOP If the data in the current cell is 0, then jump to the command immediately following the nearest ENDL.
ENDL If the data in the current cell is not 0, then jump to the nearest LOOP.
HLT Halt.
PUSH The top of the stack becomes the data of the current cell, the stack pointer moves up one position, and the current cell is cleared.
POP The current cell data becomes the top of the stack, the stack pointer moves down one position, and the top of the stack is discarded.
LET Transfer the data from the current cell to the accumulator. Accumulator is AC and stack top is ST.
SET Transfer the data from the accumulator to the current cell.

Or maybe:

Command Table
Command Description
> Point the pointer to the next cell.
< Point the pointer to the previous cell.
^ Go to previous tape.
v Go to next tape.
+ Add 1 to the data in the current cell.
- Subtract 1 from the data in the current cell.
* Multiply the data in the current cell by accumulator.
` Divide the data in the current cell by accumulator, result is rounded towards 0.
% Divide the data in the current cell by accumulator, result in remainder.
; Read a decimal integer from CON and store it into the current cell. If other characters are encountered, only the part before the character will be read. Leading zeros will be ignored.
: Output the data of the current cell as an integer to CON.
, Read a character from the CON and store it in the current cell.
. Output the current cell as a Unicode character. If the data in the current cell corresponds to an invalid code point, do nothing.
$x Jump to the specified label without any checks.
[ If the data in the current cell is 0, then jump to the command immediately following the nearest ENDL.
] If the data in the current cell is not 0, then jump to the nearest LOOP.
@ Halt.
( The top of the stack becomes the data of the current cell, the stack pointer moves up one position, and the current cell is cleared.
) The current cell data becomes the top of the stack, the stack pointer moves down one position, and the top of the stack is discarded.
/ Transfer the data from the current cell to the accumulator.
\ Transfer the data from the accumulator to the current cell.
{ Skip all content inside the curly braces. Must match } strictly.=
~ Define a label. Must match ! strictly.

Examples

We use the slow variant, which retains more features of Brainfuck.

Transfer value

(x)

Here, x represents the x-th cell, and we designate the number of the first cell as 0 instead of 1.

Hello, World!

Since this language itself is a variant version of Brainfuck on another timeline, Brainfuck programs are fully applicable here.

+++++++++++[>++++++>+++++++++>++++++++>++++>+++>+<<<<<<-]>+++
+++.>++.+++++++..+++.>>.>-.<<-.<.+++.------.--------.>>>+.>-.

See also

Brainfuck

Categories