Guru lang is a toy programming language written in Typescript.
npm i -g heluguru
Edit the file with a text editor. You can also try out your code on Helu Guru PlayGround
hi guru
helu guru "Hello guru";
bye guru
heluguru test.guru
hello guru
hi guru
is the entrypoint for the program and all program must end with bye guru
. Anything outside of it will be ignored.
This will be ignored
hi guru
// Write code here
bye guru
This too
Variables can be declared using guru idu
.
hi guru
guru idu a = 10;
guru idu b = "two";
guru idu c = 15;
a = a + 1;
b = 21;
c *= 2;
bye guru
Numbers and strings are like other languages. Null values can be denoted using khali. sari and tappu
are the boolean values.
hi guru
guru idu a = 10;
guru idu b = 10 + (15*20);
guru idu c = "two";
guru idu d = 'ok';
guru idu e = khali;
guru idu f = sari;
guru idu g = tappu;
bye guru
Use helu guru
to print anything to console.
hi guru
helu guru "Hello World";
guru idu a = 10;
{
guru idu b = 20;
helu guru a + b;
}
helu guru 5, 'ok', khali , sari , tappu;
bye guru
Heluguru supports simple if else construct , ond vele guru
block will execute if condition is sari
and illa andre guru
block will execute if condition is tappu
.
hi guru
guru idu a = 10;
ond vele guru (a < 25) {
helu guru "a is less than 25";
} illa andre guru {
helu guru "a is greater than or equal to 25";
}
bye guru
Statements inside guru yavaga
blocks are executed as long as a specified condition evaluates to sari. If the condition becomes tappu
, statement within the loop stops executing and control passes to the statement following the loop. Use nilsu guru
to break the loop and mundhe nodu guru
to continue within loop.
hi guru
guru idu a = 0;
guru yavaga (a < 10) {
a += 1;
ond vele guru (a == 5) {
helu guru "andar se helu guru ", a;
mundhe nodu guru;
}
ond vele guru (a == 6) {
nilsu guru;
}
helu guru a;
}
helu guru "done";
bye guru