Skip to content

dharshan/gurulang

 
 

Repository files navigation

Guru Lang

Build

Guru lang is a fun programming language forked from BhaiLang :)

Do checkout the online Guru Lang PlayGround.


Installation

npm i -g gurulang

Usage

Create a new file (test.guru)

Edit the file with a text editor.
namskara guru
  helu guru "Hello Guru";
aythu guru

Run

gurulang test.guru

Output

Hello Guru

Documentation

General

namskara guru is the entrypoint for the program and all program must end with aythu guru. Anything outside of it will be ignored.


This will be ignored

namskara guru
// Write code here
aythu guru

This too

Variables

Variables can be declared using nodu guru.


namskara guru
  nodu guru a = 10;
  nodu guru b = "two";
  nodu guru c = 15;
  a = a + 1;
  b = 21;
  c *= 2;
aythu guru

Types

Numbers and strings are like other languages. Null values can be denoted using nalla. nija and sullu are the boolean values.


namskara guru
  nodu guru a = 10;
  nodu guru b = 10 + (15*20);
  nodu guru c = "two";
  nodu guru d = 'ok';
  nodu guru e = nalla;
  nodu guru f = nija;
  nodu guru g = sullu;
aythu guru

Built-ins

Use helu guru to print anything to console.


namskara guru
  helu guru "Hello World";
  nodu guru a = 10;
  {
    nodu guru b = 20;
    helu guru a + b;
  }
  helu guru 5, 'ok' , nija , sullu;
aythu guru

Conditionals

Gurulang supports simple if else construct , guru eega block will execute if condition is nija and illandre guru block will execute if condition is sullu.


namskara guru
  nodu guru a = 10;
  guru eega (a < 25) aadre{
   helu guru "a is less than 25";
  } illandre guru {
   helu guru "a is greater than or equal to 25";
  }
aythu guru

Loops

Statements inside guru ellivargu blocks are executed as long as a specified condition evaluates to nija. If the condition becomes sullu, statement within the loop stops executing and control passes to the statement following the loop. Use saak bidu guru to break the loop and mundhe nodu guru to continue within loop.


namskara guru
  nodu guru a = 0;
  guru ellivargu (a < 10) {
   a += 1;
   guru eega (a == 5) aadre{
    helu guru "olaginda helu guru ", a;
    mundhe nodu guru;
   }
   guru eega (a == 6) aadre{
    saak bidu guru;
   }
   helu guru a;
  }
  helu guru "done";
aythu guru

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.6%
  • JavaScript 1.6%
  • CSS 0.8%