Ecliptica

From Esolang
Jump to navigation Jump to search

Commands

Command Description
+ Increases the value of the current memory cell by 1.
- Decreases the value of the current memory cell by 1.
? x () Checks if the value of the current memory cell equals to x; if true, executes the code inside `()`.
i Takes input from the user and saves it into a stack; whenever used, it pops from that stack into the current memory cell.
n Checks if the current cell is negative; if so, sets it to 0; if not, sets it to 1.
> Moves the pointer to the right.
< Moves the pointer to the left.
O Outputs the current memory cell as a character.
o Outputs the current memory cell as an integer.
[ Starts a loop.
] Ends a loop.
x Terminates the program.
t Escapes from a loop.
l Stores the length of the input stack in the current memory cell.
p x sets cell x value same as current cell value
P x sets current cell value same as cell x
'x' sets current cell value to ascii value of x
r decreases current cell 1-5 or increases randomly.
/comment/ comments are writen inside / / but they will effect speed of the program by a lot
" " (space) No operation.
"\n" No operation.

Example Programs

  • Truth Machine
 - i?48(x)?49([1o])
 - The program begins by using `i` to get input from the user and save it into the current memory cell.
 - It then checks if the current memory cell is equal to 48 (the ASCII value for '0') using `?48`. If it is, the program executes `x`, terminating the program.
 - Next, it checks if the current memory cell is equal to 49 (the ASCII value for '1') with `?49`. If this condition is true,prints 1 in a loop.
  • Cat
 - [iO]
 - The program starts with `i`, which gets input from the user.
 - It then outputs the input as a character using the uppercase `O`.
 - And then repeats the loop `[]` .
  • hello world
 - >++++++++[<+++++++++>-?0(t)]<O>++++[<+++++++>-?0(t)]<+O+++++++OO+++O>>++++++[<+++++++>-?0(t)]<++O------------O>++++++[<+++++++++>-?0(t)]<+O<O+++O------O--------O>>>++++[<++++++++>-?0(t)]<+O
 - hello world program translated from brainfuck to ecliptica only diffrence is loops
  • Note: This language is highly case-sensitive and i input works same as brainfuck.