Weird Programming Language?

  scripts
  sprites
See inside
Instructions

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

EXAMPLES
e5,o,
This would set mem1 to 5 and print it.

e5,c2,e7,c1,ap2,o,
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.

e5,mp1,mp1,o,
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.

e0,c2,e0,c3,e69,c4,e120,c1,r,o,
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.

e5,o,g1,
This will set mem1 to 5, print it, then go back to the start hence printing 5 forever.

e0,c2,e0,c3,e69,c4,e120,c1,r,a2,r,g30,
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.

c5,e5,c1,e0,c2,e0,c3,e69,c4,e120,c1,r,c10,ei1,m10,c2,ap10,c1,c11,ei2,m10,c1,sp11,c12,ei4,m10,c1,ap12,c13,ei3,m10,c2,sp13,c1,n,r,g38,
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
API

Render (r)
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])"

Goto (g)
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.

If (f)
The if is essentially the Goto function but it only does that IF the current mem is greater than 0

The iO
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

Notes and Credits

Forum topic: https://scratch.mit.edu/discuss/topic/314592/
Optimized on Scratch 3.0: https://llk.github.io/scratch-gui/develop/#245681572

Shared: 6 Sep 2018 Modified: 13 Sep 2018
Favorite this project 6
Love this project 7
Total views 85
View the remix tree  3
  
More projects by herohamp