RASEL

From Esolang
Jump to navigation Jump to search
RASEL
Paradigm(s) imperative
Designed by User:Nakilon
Appeared in 2020
Memory system stack-based
Dimensions two-dimensional
Computational class Turing complete
Reference implementation Github
Influenced Befunge, Funge-98
File extension(s) .rasel


RASEL (Random Access Stack Esoteric Language) is a fungeoid esoteric programming language. RASEL code is laid out on a two-dimensional, rectangular (and effectively toroidal) program space of instructions, each represented by a single ASCII character, lines separated by newlines. Unlike Befunge, RASEL is not self-modifying, that is, the instructions cannot change after the program is loaded. The additional ability of random read access to the stack is added instead. Stack data type is Rational while numerators and denominators are bignums. That means precision is limited only by the available memory of the host system, and there should be no rounding errors. Program space size also does not have any predefined limits and is calculated during the initial source code load.

Instructions

@ exit with code taken from the stack
" toggle "stringmode" (by default is off)
# "trampoline" -- the character under the next instruction pointer position will be ignored
0..9, A..Z push single Base36 digit value onto the stack
$ "discard" -- pop a value and do nothing with it
: "duplicate" -- pop a value and add it back to the stack twice
\ "swap" -- pop a value twice and put them back in reverse order
>, <, ^, v set instruction pointer direction
-, /, % pop two values and push the result of an arithmetic operation
. pop a value and print it as a number
, pop a value and print it as a char of the corresponding ASCII code
~ read character from STDIN, put its ASCII code onto the stack and work as "trampoline" unless EOF
& read Base10 non-negative integer from STDIN, put it onto the stack and work as "trampoline" unless EOF
j "jump forward" -- pop a value from the stack and jump over that many cells in the current instruction pointer direction
? "if positive" -- pop a value and work as "trampoline" if it's positive
a "take at" -- pop a value N from the stack, then copy the Nth value from it to the top

Examples

Hello, World!

A"!dlroW ,olleH">:?@,Hj

Cat program

~@,

Factorial

1& v  >$.A,@
   >:?^:14a//\1-

Nth Fibonacci number

1& v    >$$.A,@
   >1-:?^004a-5a--\

External links