From Esolang
Jump to navigation Jump to search

Fumble is a self modifying stack based esolang designed by Moon_


The name of something is put inside the brackets i.e {func:pu-1}, data for a function are put in square brackets. Function data is formatted as follows: [args:< var names >]. Arguments cannot be modified. Arguments are given to a function unenclosed, separated by -'s, like so: func-"foo"-bar-1-*baz (that demos all argument types). It uses classic C escape codes. Fumble uses the ! character to express a negative literal

Fumble's comment system uses %* to start a comment and *% to end one.

Return data is best put into its own personal variable or pushed to the stack. () brackets are used to make a new scope inside code, they are useful for local variables defined using [].

Fumble's stack has no size limit, making Fumble potentially turing complete.

Fumble supports threading, and each thread has its own stack to work with. A thread can be started using 'async{%* Code goes here *%}', which pushes the thread id to the stack. Fumble interpreters should associate a simpe value with the real thread id, the main thread always having the value of 1. Fumble can preform operations on other threads besides ending them and pausing them, it can force jumping to other parts of the code and push data to the thread's stack.

Fumble can manipulate other functions in its code using a set of instructions, this is done by a function that contains a 'wrapped' version of the function, functions can also manipulate themselves. Functions are wrapped using [{}] bracket sets, like so: [{function}]. The function can be manipulated based on its wrapped name (<function name>w) to insert, remove, and modify its lines.

Fumble has a pointer system to allow variables to point to another variable.

Commands and operations

pu: push[args:a] pushes

po: pop[args:*a] pops

add: add[args:a,b] pushes number

sub: sub[args:a,b] pushes number

div: div[args:a,b] pushes number

mult: mult[args:a,b] pushes number

inc: inc[args:*a] increments

dec: dec[args:*a] decrements

cmp: cmp[args:a,b] pushes number 0-2, 0 means less than, 1 means equal, and 2 means greater than

set: set[args:*a,b] sets something to a value

print: print[args:a] prints

strin: strin[args:*a,strmaxsize] gets a string

charin: charin[args:*a] gets a char

stackout: stackout[args:a] prints out n values from the stack

al: al[args:wrappedfunction,a,location] Adds a line to a function at the specified location

rml: rml[args:wrappedfunction,a,location] Removes a line from a function

Flow control

for-<initialization>-<condition>-<operation>(< code >)

while-<condition>(< code >)

if-< condition >(< code >)

until-< condition >(< code >)continues until a condition is met.

unless-< condition >(< code >)Preforms code and ends the function/program unless a condition is met

continueuntil-< condition >(< code >) allows the code to continue until a condition is met, once met, it preforms the code and once the code is done jumps back to the instruction it triggered on.

Example programs

Hello world!

 print-"Hello, World!"


 print-"'s factorial is"
 %*This is untested (of course) and may not work*%

Pretending decimal numbers exist

 [nump1,nump2,dat,a] %* nump1 is the whole number and nump2 is the decimal
 set-dat-100 %* 10^n, n being how many decimal places you want. *%
 until-{cmp-nump2-dat pu-a add-a-1}(