Skip to content
Aadhithya Sankar edited this page May 11, 2022 · 15 revisions

25074835_10155813718636544_911774488700200074_o

Welcome to the rajini++ wiki! rajini++ (a.k.a rajiniPP, pronounced rajini plus plus) is a simple programming language created as a hobby project and dedicated to the one and only Superstar. The language has its syntax based on the iconic dialogues of Superstar Rajinikanth. This wiki acts as the official guide to the rajini++ programming language.

rajini++(a.k.a rajiniPP) is the programming language and rajinipp is the interpreter for the rajini++ programming language.

This project develops the rajinipp interpreter for the rajini++ language and is written written in python🐍. Simply put, the project parses the rajini++ code, converts it to its equivalent python code and executes it.

Installation

  • currently, the only way to install the rajinipp interpreter is to clone the repo and build and install the wheel yourself. You need to have at least python 3.8 installed.
  • clone project: git clone https://github.com/aadhithya/rajiniPP.git
  • change directory to rajiniPP: cd rajiniPP
  • We use poetry to manage dependencies. install poetry: pip install poetry
  • generate wheel: poetry build
  • install rajini++: pip install dist/rajinipp-0.0.1-py3-none-any.whl
  • test installation: rajinipp version

The pre-built wheels will soon be made available on GitHub and elsewhere.

The rajini++ Language

rajini++ program files

rajini++ programs are stored in files with the .rpp extension.

Running rajini++ programs

the rajinipp package needs to be installed in order to run rajini++ programs.

  • rajini++ programs can be run using the following commands:

    • rajinipp run path/to/program.rpp (or)
    • python -m rajinipp run path/to/program.rpp where the program to run is stored in the path/to/program.rpp file.
  • The rajinipp package also allows users to see the the tokens from the lever. This can be achieved using the following command:

    • rajinipp tokenize path/to/program.rpp (or)
    • python -m rajinipp tokenize path/to/program.rpp
  • More about the rajinipp package coming soon.

Main method

Every rajini++ program resides within the main method. The main method is of the form:

LAKSHMI START
[statements]
MAGIZHCHI

where,

  • LAKSHMI START: denotes the start of the main method.
  • MAGIZHCHI: denotes the end of the main method.

Statements

  • Every statement in the rajini++ language terminates with a semicolon(;).
    • Example: DOT "Hello, world"; print Hello, world to the console.
  • Every command supported by rajini++ is capitalised.

Features

rajini++ currently supports the following features:

Comments

  • rajini++ supports single line comments.
  • lines beginning with !! are treated as comments and are ignored by the interpreter.

Example:

LAKSHMI START
!! This is a comment and is ignored by the rajinipp interpreter.
DOT "Hello, world!";
MAGIZHCHI

will output Hello, world! to the console.

Printing

The statement DOT can be used to print variables, strings, etc.

  • The hello world program:
LAKSHMI START
DOT "Hello, world!";
MAGIZHCHI

will print Hello, world! to the console.

Printing expressions

  • when printing an expression, rajini++ will automatically evaluate the expression before printing it.
  • Example: DOT 5*5; will output 25.0 to the console.

Printing multiple expressions/variables

  • rajini++ also supports printing multiple variables/epressions using the same DOT statement. This can be done by specifying the expressions/variables one after the other separated by a space.

  • Example:

    DOT "Hello, world! 5 + 5 =" 5+5; will output Hello, world! 5 + 5=10.0 to the console.

Variables

  • rajini++ supports variables of type boolean, string and number.

  • NOTE: Variable names can only contain small letters!

Declaring a variable

  • whenever a variable is declared, its initial value must be set.

  • Variables can be created using the following command:

    AANDAVAN SOLLRAN <variable-name> ARUNACHALAM SEIYARAN <value>;

Accessing variables

  • Variavles can be accessed using their names.

Assigning values to existing variables

  • new values can be assigned to existing variables using the following command:

    <variable-name> BHAJJI SAAPDU <new-value>;

Example program:

LAKSHMI START
!! declare a variable.
AANDAVAN SOLLRAN myvar ARUNACHALAM SEIYARAN 25;

!! access variable and print its value.
DOT "myvar = " myvar;

!! assign new value to variable.
myvar BHAJJI SAAPDU 100;
DOT "new myvar = " myvar;
MAGIZHCHI

will output the following:

myvar = 25.0
new myvar = 100.0

Boolean variables

  • rajini++ supports boolean variables.
  • The term True evaluates to true and the term False evaluates to false.

Example:

LAKSHMI START
!! declare a boolean variable with value True.
AANDAVAN SOLLRAN truevar ARUNACHALAM SEIYARAN True;

!! declare a boolean variable with value False.
AANDAVAN SOLLRAN falsevar ARUNACHALAM SEIYARAN False;

DOT "truevar = " truevar;
DOT "falsevar = " falsevar;

MAGIZHCHI

will output the following:

truevar = True
falsevar = False

String variables

  • rajini++ supports string variables.
  • anything enclosed within double quotes (") is evaluated as a string.
  • example: "Hello String" evaluates to a String.

Number variables

  • rajini++ supports integer and decimal numbers, but all numbers are implicitly represented as float32.
  • example: 420 and 4.20 evaluates to a number.

Arithmetic Operations

rajini++ supports all basic math ops:

  • Addition: +
  • Subtraction: -
  • Multiplication: *
  • Divison: /
  • Modulo: %

Example - math ops between two numbers and assigning it to a variable:

LAKSHMI START
!! addition operation
AANDAVAN SOLLRAN addvar ARUNACHALAM SEIYARAN 25 + 15;
!! subtraction operation
AANDAVAN SOLLRAN subvar ARUNACHALAM SEIYARAN 25 - 15;
!! multiplication operation
AANDAVAN SOLLRAN mulvar ARUNACHALAM SEIYARAN 5 * 5;
!! division operation
AANDAVAN SOLLRAN divvar ARUNACHALAM SEIYARAN 5 / 5;
!! modulo operation
AANDAVAN SOLLRAN modvar ARUNACHALAM SEIYARAN 51 / 5;
DOT "addvar = " addvar;
DOT "subvar = " subvar;
DOT "mulvar = " mulvar;
DOT "divvar = " divvar;
DOT "modvar = " modvar;
MAGIZHCHI

will output the following to the console:

addvar = 40.0
subvar = 10.0
mulvar = 25.0
divvar = 1.0
modvar = 1.0

Logical Operations

rajini++ rupports the following logical operations:

  • Greater Than (GT): >
  • Less Than (LT): <
  • Greater Than Equal To (GTE): >=
  • Lesser Than Equal To (LTE): <=
  • Equal To (EQ): ==
  • Not Equal To (NEQ): !=

Example Program:

LAKSHMI START
!! Declare variables
AANDAVAN SOLLRAN x ARUNACHALAM SEIYARAN 5.5;
AANDAVAN SOLLRAN y ARUNACHALAM SEIYARAN 15;
AANDAVAN SOLLRAN a ARUNACHALAM SEIYARAN x;
AANDAVAN SOLLRAN b ARUNACHALAM SEIYARAN y;

!! print variables
DOT "x: " x "y: " y;
DOT "a: " a "b: " b;

!! Test Logical Operations
DOT "x > y: " x > y;
DOT "x >= y: " x >= y;
DOT "x < y: " x < y;
DOT "x <= y: " x <= y;
DOT "x == a: " x == a;
DOT "x != b: " x != b;
MAGIZHCHI

will result in the following output:

x:  5.5 y:  100.0
a:  5.5 b:  100.0
x > y:  False
x >= y:  False
x < y:  True
x <= y:  True
x == a:  True
x != b:  True
Clone this wiki locally