Skip to content

Latest commit

 

History

History
141 lines (123 loc) · 3.08 KB

doc.md

File metadata and controls

141 lines (123 loc) · 3.08 KB

Documentation

its not a rickroll! get into the car and the journey is gonna start in 3 secs

Notice:

The syntax of RickRoll-Lang is not same as Python

  1. It doesn't need indentation
  2. The code must be written inside the main method, otherwise the interpreter will not execute

Commands to execute your code

Execute by converting .rickroll to Python

python3 RickRoll.py [Source Code File Name]

Execute by converting .rickroll to C++ (Requires g++ compiler, however this feature is quite immature, sometimes probably won't work)

python3 RickRoll.py -cpp [Source Code File Name]

If you want to know the execution time:

Add "--time"

python3 RickRoll.py [Source Code File Name] --time

Generate and play an audio from .rickroll (This feature is quite new)

python3 RickRoll.py [Source Code File Name] --audio

Hello World

take me to ur heart                                                    # This is the MAIN METHOD
    give msg up "Never gonna give you up, never gonna let you down~\n" # Define a variable
    i just wanna tell u how im feeling msg                             # print the "msg" variable
say goodbye                                                            # End the main method

And you can get the output on your terminal:

Never gonna give you up, never gonna let you down~

Defining Variable

You can define int, float, string, list/array, set, and tuple.

give a up 10
give b up "It is a string"
give c up ["This", "is", "an", "array"]

If Statement

Indentation in RickRoll-lang is optional.

take me to ur heart~    # You can add "~" at the end of the statement (it is totally optional)
    give a up 10

    and if u ask me how im feeling a is 10
        i just wanna tell u how im feeling "A is 10!"
    say goodbye

say goodbye~

Equivalent to Python:

if __name__ == '__main__':
    a = 10
    if a == 10:
        print("A is 10!")

And you will get this on your terminal

"A is 10!"

Loop

RickRoll supports 2 kinds of loop, the first one is endless loop, and the second one is while loop

take me to ur heart
    together forever and never to part # Endless loop

    say goodbye

say_good_bye

Equivalent to Python:

if __name__ == "__main__":
    while True:
        pass

While loop

take me to ur heart
    give a up 10
    together forever with a is less than 10
        give a up a + 1
    say goodbye

say goodbye

Equivalent to python:

if __name__ == "__main__":
    a = 0
    while a < 10:
        a += 1

Defining Function

RickRoll supports return function

gonna do_something arg1, arg2 # Define a function
    when i give my arg1, arg2 it will be completely # Return arg1 and arg2
say goodbye

Equivalent to Python:

def do_something(arg1, arg2):
    return arg1, arg2

Import Python Library/file

we know the LIB_NAME and we're gonna play it

Equivalent to Python:

import LIB_NAME

Embed Python Code

py: print("hello Rick Astley")
py: import sys

Equivalent to Python:

print("hello Rick Astley")
import sys