User:RaiseAfloppaFan3925/Sandbox

From Esolang
Jump to navigation Jump to search

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.

Base Extensions
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

RSI(((2 * pi) / tan(csc(55 * (pi / 180)) - x)) + 3x^3 - 15x^2 + 9x)

The title of this article is not correct because of technical limitations. The correct title is actually .
This is still a work in progress. It may be changed in the future.

is a continuation of The RSI Series meant to be freaking stupid and just an excuse for me to come back to this wiki. It is being designed to be absolutely horrendous to use while still being as practical as languages such as FORTRAN (95) and COBOL.

Influenced by: Yappacino and Nonstraightforward, Rust, C, Bash, Ada, languages with uppercase keywords such as FORTRAN 95 and COBOL

Remark: This is esoteric if you consider FORTRAN-95 and COBOL to be esoteric.

Keywords

Keywords have specific variants.

  • normal (lowercase)
  • UPPERCASE
  • TitleCase
  • iNVERSEtITLEcASE

All keywords not mentioned in the table below (e.g. climb) are allowed to exist in all four variants.

Keywords
Lowercase Uppercase Title Case Inverse Title Case
begin BEGIN Begin bEGIN
boolean BOOLEAN Boolean bOOLEAN
climb CLIMB Climb cLIMB
crop CROP Crop cROP
integer INTEGER Integer iNTEGER
is IS Is iS
module MODULE Module mODULE
parameter PARAMETER Parameter pARAMETER
proc PROC Proc pROC
short SHORT Short sHORT
unsigned UNSIGNED Unsigned uNSIGNED

Uppercase keywords must make up 60% of all keywords, lowercase must make up 25%, title case must make up 10%, and inverse title case must make up 5%. If it is a decimal, then it will be rounded down, unless it is less than 1 then it just becomes 1. Additionally, programs cannot have less than 4 keywords because of this.

Only some variants of keywords can go together.

Keyword(s) Valid combinations
begin module BEGIN MODULE
Begin module
begin module
proc [name] is [body] crop PROC [name] IS [body] CROP
Proc [name] is [body] crop
proc [name] is [body] crop
Proc [name] iS [body] Crop
cROP [name] Is [body] cROP

Types

Boolean

True is + and false is -.

boolean # x : +
x?
    + "true"<~/libstd/io/println>
    - "false'<~/libstd/io/println>
?:

Integer

Integer literals are normal, except for negative integers. They can be constructed by subtracting from zero (easier) or by checking the size of the integer, then writing the decimal representation of the two's complement representation will do.

negative_one

Examples

"Hello, world!" program

Begin module HelloWorld
PROC Main IS
    "Hello, world!"<~/libstd/io/println>
    0 clIMB
CROP

Fibonacci function

BEGIN MODULE Fibonacci
PROC Fibonacci IS
    Parameter unsigned LONG LONG iNTEGER # x
    2<x<lt>>?
        + 2 climb
        - 2<x<sub>><Fibonacci><1<x<sub>><Fibonacci><add>> climb
    ?:
CROP

IF UPPERCASE KEYWORDS == ESOTERIC THEN DIE ELSE DIE END

IF UPPERCASE KEYWORDS == ESOTERIC THEN DIE ELSE DIE END is a stupid esolang.

GOTO

GOTO [LABEL]

Or using a variable as a line number:

GOTO [VARIABLE]

Conditional form

GOTO [LABEL|VARIABLE] IF [VARIABLE 1] [>|>=|=|<=|<] [VARIABLE 2]

Twister operation

The twister operation is just this monstrosity

TWIST [A] WITH [B]

Which results in a value

Where results in 1 if is less than or equal to 1.

Examples

XKCD Random Number

AWARD POINT TO UPPERCASE KEYWORDS
AWARD POINT TO UPPERCASE KEYWORDS
AWARD POINT TO TitleCaseNames
AWARD POINT TO TitleCaseNames
TWIST UPPERCASE KEYWORDS WITH TitleCaseNames
TWIST UPPERCASE KEYWORDS WITH TitleCaseNames
DEDUCT POINT FROM TitleCaseNames
TWIST UPPERCASE KEYWORDS WITH TitleCaseNames
DEDUCT POINT FROM UPPERCASE KEYWORDS
DEDUCT POINT FROM UPPERCASE KEYWORDS
DEDUCT POINT FROM UPPERCASE KEYWORDS
USE BEST KEYWORDS
DIE