Skip to content

NoumanAmir657/ru_lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RU-Language

Introduction

RU-Language is a programming language written in C. It uses bytecode and VM to execute the instructions. RU-Lang is dynamically-typed and object-oriented language. The keywords used in this language's grammar are taken from the Roman Urdu.

Build

make

Repl

./main

File

./main <filename>.ru

Documentation

Print statement

chhaap "this is ru tutorial";

Class Declaration

khaaka A {
    method() {
        chhaap "this is a class method";
    }
}

Function Declaration

tafaaul loop(number) {
    chhaap "this is a function";
}

Variable Declaration

elaan dard <- "this is pain";

For Loop

shoro (elaan i <- 0; i < number; i <- i + 1) {
        chhaap i;
}

If-else

agr (glt) {
    chhaap "hhaha";
}
warna {
    chhaap "heheh";
}

Return in functions

tafaaul loop(number) {
    shoro (elaan i <- 0; i < number; i <- i + 1) {
        chhaap i;
    }
    lautana "Done";
}

While-loop

elaan i <- 0;
jbtk (i < 5) {
    chhaap i;
    i <- i + 1;
}

Inheritance

khaaka A {
    method() {
        chhaap "A";
    }
}
khaaka B -> A {
    method() {
        chhaap "showing inheritance";
    }
}

Method and fields

khaaka A {
    method() {
        chhaap "A";
    }
}

A.method();
A.name <- "ha ha ha";

This

khaaka A {
    method() {
        chhaap this.name;
    }
}

elaan a = A();
a.name <- "ha ha ha";
a.method();

Super

khaaka A {
    method() {
        chhaap "A";
    }
}

khaaka B -> A {
    method() {
        elaan closure <- super.method;
        closure();
    }
}

elaan b <- B();
b.method();

True

durust

False

glt

References

Crafting Interpreters

About

Programming language written in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published