Rcpy
Idea
RCPY is an esotheric programming language that is supposed to read as a recipe. It turned out te be something magical, where you can pass your 3 onions to cook potatos and end up with 100 potatos. This is really your party, but you have to program you own cake baking function... Don't tell your guests you made it with yogurt instead of whipped cream, they won't notice but still. It does this by butchering the english language. Example:
while: potatos < 100; ( potatos + 1 potatos )
^ this is verry correct syntax
Current features
Currently rcpy has the following features.
- literal arithmetic expressions
Example | Explanation |
---|---|
12 | a literal integer |
onion | a variable |
- Binary arithmetic expressions
Operator | Example | Explanation |
---|---|---|
+ | onios + 2 |
adds an arithmetic to the preceding one |
- | onions - 3 |
subtracts an arithmetic from the preceding one |
* | onions * onion |
multiplies an arithmetic with the preceding one |
/ | 100 / onions |
divides an arithmetic with the preceding one |
- Relational expressions
Operator | Example | Explanation |
---|---|---|
== | onions == scallions |
returns true if onions is equal to scallions, false otherwise |
< | onions < scallions |
returns true if onions is smaller than scallions, false otherwise |
> | onions > scallions |
returns true if onions is greater than scallions, false otherwise |
<= | onions <= scallions |
returns true if onions is smaller or equal to scallions, false otherwise |
>= | onions >= scallions |
returns true if onions is greater of equal to scallions, false otherwise |
- Assign statements
Arithmetic values can be assigned to variables.
2 onions 3 scallions
Above here the value of '2' is assigned to onions and '3' is assigned to scallions. As you can see the assignment operator is not explicitly visible, that is because it is implicit. Also, as you can see assignments are also processed from right to left as opposed from normal languages. This allows one to do... unconventional things.
scallions are better than onions and you cannot change my mind
The above code assigns all words in 'are better than onions and you cannot change my mind' to the same value as 'scallions', which ironically disproves the statement.
If statements
As noted previously onions now equal scallions. Example:
if: onions equal scallions; ( onions + scallions onions )
^ Following this onions now equals 6. > sadly else () is not yet implemented
While loops
While while loops work. Example:
while: potatos < 100; ( potatos + 1 potatos )
Return
Artithmetics can be returned with two keywords; return
and serve
Functions
This language has functions! Functions are declared by telling how to do something, with the keyword 'howto'. Example:
howto cook: bread, butter ; ( butter + bread soup then serve soup )
Functions are then called like this: Example
potatos, onions; cook potatos
The parameters are specified left of the function call.
Fibonachi
Here's a fibonachi example: Example:
300 onions 0 potatos 0 scalops 1 lettuce 1 index 1 loop if: onions < 1; ( 0 loop ) if: loop ; ( while: index < onions ; ( lettuce stash lettuce + scalops lettuce stash scalops index + 1 index ) lettuce potatos ) serve potatos
How to run
In your commandline, type: Example:
python3 rcpy.py whatheverfileyouwanttocall.rcpy
Limitations
Negativity
Negative ingedients don't exist, that would be stupid... But if you do need them, don't tell anyone I told you this: Example:
0 - 5 broccoli
it will equal -5 broccoli.
Errors
If shit hits the fan, the interpreter won't help you.
Comming features
- floats, don't exist yet
- errors, will probably be in the form of a certain Scottish chef telling you you are an idiot sandwich, but will at least tell where you failed.
- else, and maybe even else if.
Credits
Idea is credited to my brother, Colin.