RecurseMe

From Esolang
Jump to navigation Jump to search

RecurseMe is a esoteric programming language invented by User:Zzo38 that the program code can call itself recursively.

Commands

  • + - < > = Same as Brainfuck
  • [ ] = Mark beginning and end of entire program, anything after ] is comments
  • # = Call itself recursively
  • Lowercase letters = Swap value at pointer with value of a register (all registers start at zero)
  • Uppercase letters = If value of register is zero, then exit subroutine, if non-zero, then go back to beginning of subroutine
  • ; : = Input to/output from last register swapped (if none, then error)
  • Numbers 0 to 9 = Skip a number of commands if value at pointer is zero (so 0=NOP, 1=skips next command if value is zero, etc.)
  • & = Skip next 2 commands
  • / = Switch between main memory and auxilliary memory (only affects + - < > and numbers commands)

SimulRecurseMe

This variant of RecurseMe is one where you can have multiple programs running simultaneously (well, not really, because it has to wait for input/output, so it is more like coroutines), doing input and output between each other. You can also have macros.

Each subprogram is defined with name in {} before [ and each macro is defined with name in () before [ and macros are called with name in ()

Subprograms each have their own memory and registers, they run separately from main program and other subprograms. To select a subprogram to input/output with, use {} with name in between, in the program code. Use {} with nothing in between for I/O with the caller (with the program's main input/output if the main program).

Macros are included by writing their name within () within the program code. Macros do not accept parameters.

Examples

Cat program:

[z;:Z]

Simple variable storage in SimulRecurseMe: (Make a variable with something like: {name}[(var)])

(var)[zz:;1&++yY]
(store)[z;zy:y]
(recall)[z;:z]