SumaMoito

SumaMoito is a collection of languages that aims to include minimal Turing-complete languages with a particular style.

Currently there are three languages in this collection: SumaMoito-Z1, SumaMoito-Z2 and SumaMoito-N.

They have been published in this wiki by User:Atrapado.

SumaMoito-Z1
has the following elements:

a $             # variable declaration. variables are unbounded integers initialized to 0. a +             # variable increment. a -             # variable decrement. a % ...         # loop. execute given block of code (...) while 'a' is not equal to 0.

SumaMoito-Z2
has the following elements:

a $             # variable declaration. variables are unbounded unsigned integers initialized to 0. a +             # variable increment. a -             # variable decrement. does nothing if the variable is already 0. a % ...         # loop. execute given block of code (...) while 'a' is not equal to 0.

SumaMoito-N
has the following elements:

a $             # variable declaration. variables are unbounded unsigned integers initialized to 0. a +             # variable increment. a =             # variable reset. set variable to value 0. a b % ...       # loop. execute given block of code (...) while 'a' not equals 'b'.

Computational class
SumaMoito-Z2 has been proven Turing complete by simulation of Bitwise Cyclic Tag. The details required to construct the interpreter can be found in the log of #esoteric for 8 January, 2012.

SumaMoito-N has been proven Turing complete by reducting SumaMoito-Z2 to SumaMoito-N. Below is the proof.

Z2--N block          block declaration    declaration increment      increment decrement      dec1 (see decrement examples below) a % ...        zero $ a zero % ...

SumaMoito-Z1 is also Turing complete, proven by reducting Sumamoito-Z2 to SumaMoito-Z1. Below is the proof.

Z2--Z1 block          block declaration    declaration increment      increment decrement      dec3 (see decrement examples below) loop           loop

Language development

 * Tokens are separated by whitespace.
 * Nesting can be expressed with indentation.
 * Alternative format with '{' and '}' instead of indentation.
 * There are procedures, which may have arguments.
 * Argument passing is by reference; any procedure argument can be used for input and output.
 * Procedures are declared with the name of the procedure, followed by arguments, followed by '@'
 * Procedure calls are defined with the name of the procedure, followed by arguments, followed by '!'
 * Variable declarations can appear anywhere (before using) and its scope begins in the previous '{' and ends in the matching '}' (or corresponding indentation); a variable can not be declared twice in the same scope; declaring the same variable name in different (overlapping or not) scopes of the same procedure has been not decided whether it is allowed or not.
 * In principle it is not valid to mix code from the different languages (-Z1 -Z2 -N) neither call procedures from one language to another.

Copy
Copy the value from one variable to another without destroying the first one.

SumaMoito-Z2 code:

copy1 a b @ c $ b % b - a % a - b + c + c % c - b + a +

SumaMoito-N code:

copy2 a b @ b = a b % b +

Add two values onto a third one
SumaMoito-Z2 code:

sum3a a b c @ e $ f $ g $ copy1 a e ! copy1 b f ! copy1 g c ! e % c + e - f % c + f -

SumaMoito-N code:

sum3b a b c @ d $ c = c a % c + d b % c + d +

Add one value to another
SumaMoito-Z2 code:

sum2a a b @ e $ copy1 a e ! e % b + e -

SumaMoito-N code:

sum2b a b @ d $ d a % b + d +

Multiply
SumaMoito-N code:

mult3 a b c @ d $ c = d a % sum2b b c ! d +

Decrement
SumaMoito-N code:

dec1 a @ tmp $ a tmp % b $ c $ b + b a % b + c + a = a c % a + tmp +

dec2 in out @ temp $ out = in temp % copy2 in temp ! tmp $ tmp + tmp in % out + tmp +

SumaMoito-Z1 code (decrement if greater than 0; only works for positive or 0 values):

dec3 a @ tmp1 $ tmp2 $ a % tmp1 + tmp2 + a - tmp1 % tmp1 - a + tmp2 % tmp2 % tmp2 - a -