SrijanSriv / jlambda

An attempt to make an interpreter for a language using Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lambda

The origin of the Lambda Programming Language. Build using Java for experimentation and ease of understanding.

The Language

You can download the language from the releases section! Just head to the Releases section and download the .jar. You can run a file in the .orz extension in the same directory where the .jar is saved by the command:

java -jar .\lambda.jar main.orz

Examples

Hello world

// The famous hello world
print "Hello, lambdas!";

Variable declaration

var a = 300;
var b = 6;

var c = a + b;
print c; // prints 306

Loops

for (var i = 0; i < 5; i = i+1) {
  print i;
}

// prints 
// 0
// 1
// 2
// 3
// 4

Conditionals

var a = 5;
if (a >= 4) {
  print "a is greater than or equal to 4";
} else {
  print "a is less than 4";
}

Functions

fun printSum(a, b) {
  print a + b;
}

Classes

class Greeter {
  init(name, time) {
    this.name = name;
    this.time = time;
  }
  greet() {
    print "Good " + this.time + " " + this.name + "!";
  }
}

About

An attempt to make an interpreter for a language using Java


Languages

Language:Java 100.0%