User:RaiseAfloppaFan3925/Sandbox
Hi welcome to my sandbox :D
Here, you might see some of my private languages Just experimenting with stuff.
Redshift
Shift everything away.
Commands
| Command | Action | Example | Memory Layout |
|---|---|---|---|
lda
|
Stores the cell at the pointer in Register A. | self-explanatory | |
ldb
|
Stores the cell at the pointer in Register B. | self-explanatory | |
swap
|
Swaps Register A and Register B. | self-explanatory | |
sta
|
Stores the value in Register A in the cell at the pointer. | self-explanatory | |
stb
|
Stores the value in Register B in the cell at the pointer. | self-explanatory | |
si
|
Copies the memory unit at absolute byte address N from the program memory into the current memory cell. | si byte 0
|
Has options byte, short, word, and quad, which take up an extra byte
|
li
|
Loads the current memory cell into the memory unit at absolute byte address N. | li quad 8
|
Has options byte, short, word, and quad, which take up an extra byte
|
ica
|
Increment the A register | self-explanatory | |
icb
|
Increment the B register | self-explanatory | |
dca
|
Decrement the A register | self-explanatory | |
dcb
|
Decrement the B register | self-explanatory | |
add
|
Adds A and B and stores the result in A. | self-explanatory | |
sub
|
Subtracts B from A (A - B) and stores the result in A.
|
self-explanatory | |
shl
|
Left-shifts the value in A by B bits. | self-explanatory | |
shr
|
Right-shifts the value in A by B bits. | self-explanatory | |
up, down, left, right
|
Moves the cell pointer in their respective directions. | self-explanatory | |
in
|
Takes in a UTF-32 character as input. | self-explanatory | |
out
|
Outputs the current cell as a UTF-32 character. | self-explanatory | |
ge
|
Sets the GE flag if A is greater than B. | self-explanatory | |
sg
|
Sets the GE flag unconditionally. | self-explanatory | |
cg
|
Clears the GE flag. | self-explanatory | |
jge
|
Jumps to the Nth byte, starting at zero. N is an absolute address. | jge 5 jumps to the 6th BYTE, not instruction.
|
1 byte (instruction) followed by 16 bytes (target address) |
Memory
Memory is stored in the form of a grid which is constantly expanding from the first memory cell at the "speed of light". The expansion follows Hubble's law, so cells farther from the pointer will move away faster than cells closer to the pointer.
Time 0 (pointer is represented with P) A y 0 0 B x a X b 0 0 Y P Z 0 0 c W d z C 0 0 w D Time 1 A 0 y 0 0 0 0 0 B 0 0 0 0 0 0 0 0 0 x 0 a 0 X 0 b 0 0 0 0 0 0 0 0 0 0 0 0 0 Y 0 P 0 Z 0 0 0 0 0 0 0 0 0 0 0 0 0 c 0 W 0 d 0 z 0 0 0 0 0 0 0 0 0 C 0 0 0 0 0 w 0 D
The pointer moves faster than the speed of light, so any memory location is accessible.
Examples
Infinite loop
sg jge 1
With assembler extensions
sg jge $
XKCD Random Number
ica icb add ; a = 2, b = 1 swap ; a = 1, b = 2 add ica ; a = 4, b = 2 swap ; a = 2, b = 4 ica ; a = 3, b = 4 shl ; a = 48, b = 4 add ; a = 52 out ; '4'
Assembler Extensions
Redshift can be thought of as an assembly language, and so can have some extensions to the assembler. These only alter the syntax of the language, not the underlying behavior.
| Command | Action | Example | Notes |
|---|---|---|---|
$
|
The current absolute address. | self-explanatory | Address is in bytes, since some instructions (like jge) are multi-byte.
|
| Labels (text followed by a colon) | Gives an absolute memory address. | label:
|
Redshift-A
Redshift-A is a higher-level version of Redshift with some syntactic abstractions. It compiles to Redshift.
Redshift-A Examples
Infinite Loop
while true do end
Generated Redshift
cg jge 1
XKCD Random Number
store 52 ; same as setting a to 52 and storing a out cell
Generated Redshift
ica (repeated 51 more times) out
Uiua page draft
- DISCLAIMER: If you have come here to view the Uiua page, this is NOT the place. This is just a DRAFT.
- This is my first time contributing to a page and it's likely to change around 5 KB or more of data so I'll do it in my sandbox
- This draft is a stub
Year: 2023 (possibly earlier? first Git commit is Feb 27, 2023)
Reference implementation: uiua-lang/uiua
Uiua is a tacit array programming language being developed since September 2023 [1] or earlier. [2]
Functions
Most built-in functions in Uiua use special Unicode characters. Alternatively, built-in functions also have names that can be used instead of Unicode characters. The built-in formatter automatically converts these names into Unicode characters.
Constants
Constants in Uiua are functions that return a constant value.
| Commands | Symbol | Action | Notes |
|---|---|---|---|
eta
|
η
|
The number of radians in a quarter circle, equivalent to pi divided by 4 | |
pi
|
π
|
The value of pi (3.14159265358979...) | |
tau
|
τ
|
The value of tau (6.28...), equivalent to 2 times pi | |
infinity
|
∞
|
The biggest number |
Modifiers
Uiua has a special class of functions called modifiers which modify the behavior of other functions.
External resources
- Uiua official website
References
- ↑ The oldest changelog is at 2023-09-28.
- ↑ The first Git commit was on February 27, 2023.