Python transpiler for the esoteric language Rockstar
Project description
rockstar-py
Python transpiler for the esoteric language Rockstar
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Installing
First, make sure you have installed a supported Python version (>= 3.6).
Now, the easiest way of installing rockstar-py is using pip:
pip install rockstar-py
(This may require sudo
if you're installing globally on a *nix
system.
You can also clone this project using git and install the package with setuptools:
git clone https://github.com/yyyyyyyan/rockstar-py.git
cd rockstar-py
python3 setup.py install
Usage
If you installed the package using pip or setuptools, you can simply run rockstar-py in the command line:
rockstar-py [-h] (-i INPUT | --stdin) [-o OUTPUT | --stdout | --exec] [-v]
Otherwise, you can run the transpiler from inside the rockstar-py
folder by running Python with the rockstarpy
package:
python3 rockstarpy [-h] (-i INPUT | --stdin) [-o OUTPUT | --stdout | --exec] [-v]
Call rockstar-py
with the flag -h
/--help
to see a description of all options:
usage: rockstar-py [-h] (-i INPUT | --stdin) [-o OUTPUT | --stdout | --exec] [-v]
Python transpiler for the esoteric language Rockstar
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
Input file (.rock)
--stdin Stream in stdin
-o OUTPUT, --output OUTPUT
Output file (.py)
--stdout Stream to stdout
--exec Execute (without saving) the transpiled code
-v, --version Version
Examples
Just to make it more clear, some examples with the fizz.rock code.
Basic usage
> rockstar-py -i fizz.rock -o fizz.py
> ls
fizz.py fizz.rock
> cat fizz.py
def Midnight(your_heart, your_soul):
while your_heart >= your_soul: # this is a comment
your_heart = your_heart - your_soul
return your_heart
Desire = 100
my_world = False
Fire = 3 # i love comments
Hate = 5
while not my_world == Desire:
my_world += 1
if Midnight(my_world, Fire) == False and Midnight(my_world, Hate) == False:
print("FizzBuzz!")
continue
if Midnight(my_world, Fire) == False:
print("Fizz!")
continue
if Midnight(my_world, Hate) == False:
print("Buzz!")
continue
print(my_world)
Using --stdout
> rockstar-py -i fizz.rock --stdout
def Midnight(your_heart, your_soul):
while your_heart >= your_soul: # this is a comment
your_heart = your_heart - your_soul
return your_heart
Desire = 100
my_world = False
Fire = 3 # i love comments
Hate = 5
while not my_world == Desire:
my_world += 1
if Midnight(my_world, Fire) == False and Midnight(my_world, Hate) == False:
print("FizzBuzz!")
continue
if Midnight(my_world, Fire) == False:
print("Fizz!")
continue
if Midnight(my_world, Hate) == False:
print("Buzz!")
continue
print(my_world)
Using --stdin
> rockstar-py --stdin -o fizz.py
Midnight takes your heart and your soul
While your heart is as high as your soul (this is a comment)
Put your heart without your soul into your heart
Give back your heart
Desire's a lovestruck ladykiller
My world is empty
Fire's ice (i love comments)
Hate is water
Until my world is Desire,
Build my world up
If Midnight taking my world, Fire is nothing and Midnight taking my world, Hate is nothing
Shout "FizzBuzz!"
Take it to the top
If Midnight taking my world, Fire is nothing
Shout "Fizz!"
Take it to the top
If Midnight taking my world, Hate is nothing
Say "Buzz!"
Take it to the top
Whisper my world
[Ctrl+D]
> ls
fizz.py fizz.rock
Using --exec
> rockstar-py -i fizz.rock --exec
1
2
Fizz!
4
Buzz!
Fizz!
7
8
Fizz!
Buzz!
11
Fizz!
13
14
FizzBuzz!
16
17
Fizz!
19
Buzz!
Fizz!
22
23
Fizz!
Buzz!
26
Fizz!
28
29
FizzBuzz!
31
32
Fizz!
34
Buzz!
Fizz!
37
38
Fizz!
Buzz!
41
Fizz!
43
44
FizzBuzz!
46
47
Fizz!
49
Buzz!
Fizz!
52
53
Fizz!
Buzz!
56
Fizz!
58
59
FizzBuzz!
61
62
Fizz!
64
Buzz!
Fizz!
67
68
Fizz!
Buzz!
71
Fizz!
73
74
FizzBuzz!
76
77
Fizz!
79
Buzz!
Fizz!
82
83
Fizz!
Buzz!
86
Fizz!
88
89
FizzBuzz!
91
92
Fizz!
94
Buzz!
Fizz!
97
98
Fizz!
Buzz!
Contributing
The project has basically reached its end, but I'm still accepting pull requests that improve speed and legibility of the code.
Authors
- yyyyyyyan - Initial work
Contributors
Huge thanks to everyone who is contribuing to this project. Check them out at Contributors!
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Hat tip to dylanbeattie for creating Rockstar
- The FizzBuzz example works well. If valid code doesn’t work, create an issue so I can get a look.
- I’ll work on the readibility and organization of the code, would love suggestions on how/where to do that.
- I'd also love help with the tests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rockstar-py-2.1.0.tar.gz
.
File metadata
- Download URL: rockstar-py-2.1.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c870eb6cdfc270676a0c7e21367c50d991764e2297ebc51836de6c6600e6faf |
|
MD5 | 39d067c13ef3f0134c7af535c4a92f8b |
|
BLAKE2b-256 | 04bf6efc04e878fc6beb5309410f148970d44ee58ebebe60e28b9fb7012548da |
File details
Details for the file rockstar_py-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: rockstar_py-2.1.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a2c48f2623d552f1f6dde32f3295dc9203d2dd1e2baa398832a1f978f1d9242 |
|
MD5 | bbff1165955257c5dbc4513c06da75b7 |
|
BLAKE2b-256 | 3f89fdbfbf369395b2df589279e5d3ae3df0b4eb69a52e5c536723a92b03fe33 |