Weird Programming Language?
I was just doing some testing and started building this. I still wanna add sprite support and user input.
Writing a program
- All functions must end with a comma "," even the last one.
- Only 128 different variables
- The pointer is the currently selected mem
- There are only 10 functions and only have 1 input
- All Functions are only 1 character long
change pointer -> c
add -> a
sub -> s
div -> d
goto -> g (Scroll down for the API)
mul -> m
set -> e
print -> o
if -> f (Scroll Down for the API)
render -> r (Scroll down for the API)
clear render -> n
This would set mem1 to 5 and print it.
This will set the first pointer to 5, change pointer to mem2, set mem2 to 7, change back to mem1, add the value of pointer 2, print.
This will set the first pointer to 5, then multiply it by itself to set mem1 to 25, next it multiplies mem1 by itself again to get 625, then prints it.
See above for examples of the uses of e and c, this sets the correct values. Goes to mem1 the beginning of the dots data, and draws a dot at 0,0 with a size of 69, and a color of 120.
This will set mem1 to 5, print it, then go back to the start hence printing 5 forever.
This is a mix of the above 2. It initiates the mem values required for a render, renders. Then it add 2, renders again and loops back and does this add 2 and render process forever.
This creates a moving player controlable by WASD. It uses i to access mem in the IO. See the API for how iO is accessed
Rendering draws a single point at the given x and y positions, it gets the x from the current pointer, y from the current plus 1, size from current pointer plus 2, and color from current pointer color 3. For color it uses the scratch color value system. "([red 0-255] * 65536) + ([green 0-255] * 256) + ([blue 0 - 255])"
The parserer for WPL goes through and executes on a per character basis. With goto you simply base it the character to go back to. Characters start at 1. An example is found above.
The if is essentially the Goto function but it only does that IF the current mem is greater than 0
The iO is a second memory array that is accessible. It can be accessed via i(pointer). Zero means the key is not being pressed and 1 means it is. The current binding are, 1 -> W, 2 -> A, 3 -> S, 4 -> D