Rusticle is a custom language interpreter with a unique syntax. This document provides an overview of the syntax and usage of the Lin language.
Here is an example program that demonstrates the syntax of Lin:
import "add" from "addition";
// declare variables
manle a = 6;
manle b = 7;
manle c = a + b;
// conditional statements
agar (c < 0) {
likh c;
} nhito {
likh b;
}
// function declaration
functio check(a) {
likh a;
}
// function calls
check(1);
// loops
for (manle i = 0; i < 3; i = i + 1) {
likh i;
}
add(11, 11);The following keywords are reserved in Lin:
andclassnhito(else)falseforfunctio(function)agar(if)nilorlikh(print)dede(return)superthistruemanle(var)jabTak(while)importfrom
Variables are declared using the manle keyword:
manle a = 10;
manle b = 20;
manle c = a + b;Functions are declared using the functio keyword:
functio add(a, b) {
likh a + b;
}Functions can be called with arguments:
add(5, 10);Conditional statements use the agar and nhito keywords:
agar (a > b) {
likh "a is greater than b";
} nhito {
likh "a is not greater than b";
}The jabTak keyword is used for while loops:
jabTak (a < 10) {
likh a;
a = a + 1;
}For loops are structured as follows:
for (manle i = 0; i < 5; i = i + 1) {
likh i;
}Lin supports the following logical operators:
andor
Example:
agar (a > 0 and b > 0) {
likh "Both a and b are positive";
}Lin supports the following comparison operators:
>>=<<===!=
Example:
agar (a == b) {
likh "a is equal to b";
}Lin supports the following arithmetic operators:
+-*/%
Example:
manle sum = a + b;
manle difference = a - b;
manle product = a * b;
manle quotient = a / b;
manle remainder = a % b;Expressions can be grouped using parentheses:
manle result = (a + b) * c;Functions can be imported from packages using the import and from keywords:
import "add" from "addition";This will import the add function from the addition package.
The likh keyword is used to print values:
likh "Hello, World!";
likh a;Single-line comments start with //
// This is a comment
manle a = 10; // This is another comment