Mango

From Esolang
Jump to navigation Jump to search

Mango is an esolang created by User:Yayimhere, based on a specific way of parsing OISC inputs, in which the inputs overlap when interpreting.

Memory

Mango's memory is made up of variables, all of which ordered lists of strings. Variable names can be any lowercase alphabetical string. Variables have two values that come with them. One is a pointer, that points to a specific index(note that negative indexes work like python), which is mod length. There is also another string, which holds every string delete from the list. It can only be read as empty, or not empty.

Syntax

Mango programs are made up of two parts. The program part, and the memory part. The memory part comes first, and looks something like:

xyz abc; 234; ...
ppp huc; qwe; ...

as you can see, the variable names must be length 3. All the ; separated strings are the variables list elements, all of which alphanumerical strings, of unbounded length. The program section must be separated by one empty newline of the memory section, and then every command is on its own line.

Execution

After the memory part has been ran, it's deleted off the program list, before the rest is looped over forever. certain lines may be on or off during certain loops. In the case of a line thats off, it's skipped, and will be turned off in the next loop(unless turned off by the program again). All lines are be default on.

Commands

Note that here:

  • xyz and abc are used as arbitrary variables.
  • xyz.p refers to that variables pointer number.
  • xyz.[p] refers to the string pointed to by the given variables pointer.
  • xyz.[p-1] refers the the string right before the one pointed to by the variables pointer(negatives again, work like python and wrap around)
  • xyz.d refers to that variables string of deleted characters(note that it is reset every time the program loops)
  • xyz+abc refers to concatenation of xyz and abc.

Now onto the command set:

Command Description
xyz.i,j Splits xyz.[p] at index i(0 indexed) with a modulo of that strings left. Lets call the string left of the split xyz.pl, and the one right of it xyz.pr(note that the left is inclusive of the character at the index, while the right isnt). Then, the same process is then applied to xyz.[p-1], with the index j, with the name of the left and right being xyz.pml and xyz.pmr respectively. Then the string xyz.pl+xyz.pmr is appended as a new element of xyz to the end, and then xyz.pml+xyz.pr is appended. Then, xyz.p is incremented.
xyz.del delete the first element of xyz, and update xyz.d.
xyz.n.s.OFF if xyz.d is equal to the string s, turn line n OFF.
xyz.n.s.ON if xyz.d is equal to the string s, turn line n ON.
xyz.+=s append the string s to xyz unconditionally, and increment xyz.p. Only legal once for every variable.
xyz.h halt if xyz.d is empty.
xyz.in replace xyz[p] with user input.
xyz.out print xyz[p].
# everything after is not executed(comment)

Examples

Cat:

xyz .;

xyz.in
xyz.out
xyz.h