Rattle

Rattle (version 1.0.3)
A new imperative programming language
An online interpreter for the current version is available here - all you need to do is replace what's in the "code" section and hit run (I would recommend minimising the header and footer as well). Note that a better interpreter is on the way - if you would like to help set up and host an interpreter, please contact the developer with the contact information at the bottom of the page.
==Description==
This interpreted language is developed to be easy to use and hard to mess up. To achieve this, all commands are a single character and their arguments follow - for example, you would do `+2` to add 2 to the current value.
Rattle is a very versatile language - it works on a circular data tape, where you can move the pointer to whichever slot you want, and manipulate data in that slot and at the top of the stack at the same time. Rattle is an imperative programming language, like C++.
To take input, your code simply needs the | character - data types are recognised automatically. In order to use different functions in your code, you simply have to use the following format:
 MAIN_METHOD; FUNCTION_0; FUNCTION_1; FUNCTION_2 ...
In Rattle, there are many commands you can use:
 "+":add, #adds argument to top of the stack
 "-":subtract, #subtracts argument from top of the stack
 "*":multiply, #multiplies top of the stack by argument
 "/":divide, #divides top of the stack by argument
 "w":helloWorld, #prints "Hello, World!"
 "R":reformat #used to format data types
 "s":store, #stores top of the stack onto the data tape at the current pointer
 "g":get, #puts value at current pointer onto the top of the stack
 "<":pointerDown, #moves pointer down (or to the left)
 ">":pointerUp, #moves pointer up (or to the right)
 "P":setPointer, #sets pointer to argument
 "p":prnt, #prints item at the top of the stack
 "!":flag, #(used internally)
 "c":concat, #concatenates value at argument's pointer in storage to the top of the stack
 "[":startLoop, #this is the start of a loop structure - any argument here acts as an if statement
 "]":endLoop, #this is the end of a loop structure - any argument here acts as a for loop
 "%":modulo, #takes the modulo of the top of the stack with respect to the argument
 "$":swap, #swaps the top of the stack with the item in storage at the current pointer
 "r":secondArgument, #(used internally)
 "=":topOfStackEquals, #sets top of stack to argument
 "_":pointedValueInStorageEquals, #sets value in storage at the pointer to argument
 "t":stringFunction, #(currently in development)
 ",":printCharAt, #prints the character of an int value
 "a":arrayInitFunctions, #array functions (currently in development)
 "A":arrayOperations #array operations (currently in development)
 "m":matrixInitFunctions, #matrix functions (currently in development)
 "S":selectFromArray, #selects n-th item from an array
 "b":concatToPrintBuffer, #adds argument to a buffer
 "B":printAndResetBuffer, #prints buffer and resets buffer
 "i":printInteger, #prints value as int
 "q":quitProgram, #force-stops execution
 "I":storeInput, #parses and stores input
 "f":executeFunction, #executes functions - when used without an argument, acts as a return statement
 "d":debugIndex #prints "d(arg) has been executed" - useful for debugging code
You can also make use of arguments other than just numbers: You can use ~ to pass the value in storage at the current pointer, ` to pass the value at the top of the stack, and @ to pass the value of the pointer itself.
==Sample program==
Here's a sample program which takes the user's input and determines whether it is a prime number:
 |f0;[1=f]-s+>s[g<%~[0=f]g-s>]~=1
 
In a more expanded, human-readable form, this looks like this:
 | f0; [1 = f ] - s + > s [ g < %~ [0 = f ] g - s > ]~ =1
 
Going from left to right,
 | takes the user's input and parses it
 f0; calls function 0 (which is everything after the semicolon)
 [1 checks to see if the input is equal to one. If it is, then the code inside the square brackets will execute
 = sets the value at the top of the stack to zero
 f returns to the main method, the top of the stack is printed implicitly
 ] ends the if statement
 - subtracts one from the top of the stack
 s saves the top of the stack at the current pointer (0)
 + adds one to the top of the stack
 > moves the pointer right
 s saves the top of the stack at the current pointer (1)
 [ starts a for loop (it's a for loop because the argument, ~ is on the closing bracket
 g gets the value at the current pointer (1)
 < moves the pointer left
 %~ takes the modulo of the top of the stack with respect to the value in storage at the current pointer
 [0 checks to see if the result of this calculation is zero. If it is, then the code inside the square brackets will execute
 = sets the value at the top of the stack to zero
 f returns to the main method, the top of the stack is printed implicitly
 ] ends the if statement
 g gets the value at the current pointer (0)
 - subtracts one from the top of the stack
 s saves the top of the stack at the current pointer (0)
 > moves the pointer right
 ]~ ends the for loop (it executes the number of times of the value in storage at the current pointer)
 =1 sets the value on top of the stack to one - function 0 returns, the top of the stack is printed implicitly
==What's New==
Rattle version 1.0.0 has been released! Rattle is now an imperative language - it's now actually useful for normal programming!
==Upcoming releases==
Incoming changes:
*Smart multiplication! You will now be able to multiply strings!
*Better error handling
Want to see your ideas implemented? Email rattleinterpreter@gmail.com
Category:Languages Category:Implemented