Transposed

From Esolang
Jump to navigation Jump to search
Transposed
Paradigm(s) Imperative
Designed by User:ZippyMagician
Appeared in 2020
Memory system Cell-based
Computational class Finite state automata
Reference implementation Implemented
File extension(s) .tr, .itr

Transposed is a matrix-based esolang created by User:ZippyMagician.

Basic description of language

 The program: each "command" is made up of two parts; the prefix and the suffix. Each command is seperated by spaces, and each row of commands is seperated by a newline. All rows must be the same length.
 Memory: A single 16-cell memory called "C". Starts at 0
 I/O: Input can be taken as either ASCII or INT, both are supported. All outputs are done with ASCII unless the filetype is .itr instead of .tr. If no input can be found on STDIN, a -1 is given to the matrix.
 Suffixes: (N = the prefix that's currently in the matrix, C = the Memory)
 0 = NIL
 1 = READ FROM STDIN
 2 = ADD CURRENT ROW
 3 = SUBTRACT ROW
 4 = DIVIDE ROW
 5 = MULTIPLY ROW
 6 = REVERSE ROW
 7 = DELETE ROW
 8 = GOTO ROW (N-1) IF LAST ITEM IN ROW = 0
 9 = END PROGRAM
 A = ADD ALL ROWS
 B = SUBTRACT ALL ROWS
 C = DIVIDE ALL ROWS
 D = MULTIPLY ALL ROWS
 E = STORE LAST ITEM IN ROW IN C[N]
 F = PLACE C[N] INTO ROW

In-depth description

Transposed is a matrix-shaped esolang composed of sets of two numbers, the prefix and suffix. The prefix is pushed onto the current operating row of the output matrix (created at the start of the program), and then the suffix will run some command. In 3 cases (8, E, F), the suffix will not allow the prefix to enter the matrix for various reasons. Whenever a the program finishes interpreting one line and moves, even if it is back to the beginning of the same line, a new row in the matrix will be created. Once a program is finished running, the resulting matrix will be transposed and then each row outputted to the console with newlines in-between. Each prefix and suffix accepts any character used in Hexadecimal [0-9a-fA-F]. For commands A, B, C, and D, they work as follows: Let's say you call the suffix A when your output matrix looks like this:

1 2 4
3 8 5

this will result in the output matrix becoming:

1+3 2+8 4+5

this operates the same for all four of these commands.

Due to the nature of I/O in this language, it is impossible to achieve certain tasks (such as a truth machine or dynamic I/O system) without modifying the esolang. This is because no output can be created until the program is fully completed.

Programs

Here are a few programs in this esolang.

Hello World

10 90 85
A0 A5 12
10 C0 95
C0 10 95
C0 95 32
80 10 45
70 C5 32
90 C5 32
A0 B5 42
10 C0 95
A0 10 A5

Cat program

01

Cat program until EOF

01 12 28 13 00 18
09 00 00 00 00 00

Factorial Calculator

01 0E 02 02 02 00 00
0F 13 38 0E 00 0D 28
09 00 00 00 00 00 00

Calculator

Supports the 4 basic operators. Input order is: op, first #, second #

01 0E 00 00 00 00 07
60 75 12 0F 03 68 07
90 55 02 0F 03 78 07
60 85 13 0F 03 88 07
60 75 02 0F 03 98 00
01 01 00 00 00 02 09
01 01 00 00 00 03 09
01 01 10 10 10 14 09
01 01 10 10 10 15 09

Implementations