Here's the link to my Hashnode Blog on experimenting with Python to create TSwizzle.
Follow the below steps to either:
- Run your TSwizzle files in your terminal to produce output.
- Directly run the code in your terminal (like Python IDLE).
Step - 1: Clone and fork this repository to your local machine.
Step - 2: Navigate to tswizzle folder and set up venv (Python Virtual environment). You can know more about creation and activation of virtual environment in Python for different platforms, here.
Step - 3: Run python lang.py
to create your session.
Step - 4: Enter your favourite Taylor Swift era.
Step - 5: To run your .tswizzle
file, create your <filename.tswizzle> in a separate folder under the same workspace/folder the tswizzle
folder is in, and then enter the command I KNOW THE BRAVEST THING I EVER DID WAS RUN <filename.tswizzle>
.
Step - 6: Otherwise, directly execute your code in the interactive terminal itself.
Table:
Commands and Keywords | What They Do |
---|---|
I KNOW THE BRAVEST THING I EVER DID WAS RUN <filename.tswizzle> |
Executes filename.tswizzle file. |
GOODBYE GOODBYE GOODBYE | Marks the EOF when specified within the file, but when specified in the terminal directly, it acts as pass keyword. |
AND I'LL SHOW YOU EVERY VERSION OF <message> TONIGHT |
Prints <message> on the output screen/terminal where <message> can be anything the user wants to print, i.e., string, numbers, etc. Example: AND I'LL SHOW YOU EVERY VERSION OF "Hello World" TONIGHT |
NUMBER ON ME | Converts user input to number/integer type. Basically an <input_type> . |
INVISIBLE STRING TYING ME TO YOU | Converts user input to string type. Basically an <input_type> . |
SPEAK NOW OR FOREVER HOLD YOUR <input type> <variable_1> , <variable_2> |
Takes one or multiple user input. Usually input type is specified along with it followed by the user input, i.e., SPEAK NOW OR FOREVER HOLD YOUR INVISIBLE STRING TYING ME TO YOU x,y |
ARE WE IN THE CLEAR YET? | Clears screen, whether specified within the file or directly in the terminal. |
IF YOU'VE GOT A (condition_1) I'M JEALOUS OF <statement_1> BUT IF YOU'RE (condition_2) THAT'S HONESTLY <statement_2> CAUSE YOU'RE SO GORGEOUS IT ACTUALLY <statement_3> |
Python's If-Elif-Else equivalent of conditional statements. |
COUNTER ALL YOUR QUICK REMARKS ~> | Allows users to insert single-line comments. |