An interpreted language written in Rust.
- REPL
- Variables (
let, assignment) - Arithmetic expressions with precedence & unary
- String concatination and reptition
- Boolean literals (
true,false) - Comparisions
- Comments (
//) if / elif / elsewhileloopsbreak,continue,returnforloops- Functions w/ closures and recursion
git clone https://github.com/sidsurakanti/brainrot.git
cd brainrot
cargo build
cargo run[BRAINROT] REPL
<Ctrl-C> to quit.
>>> print("hello, world!");
hello, world!
>>> let a = 10;
>>> print(a);
10
>>> print(10 * 30 + (2 / 2));
301>>> let a = true;
>>> let b = false;
>>> print(a == b);
false
>>> print(b == false);
true
>>> print(a == "2");
false>>> let a = 0;
>>> while (a <= 10) {
... a = a + 1;
... if (a > 5) {
... break;
... }
... }
...
...
>>> print(a);
6>>> let a = 0;
>>> for (let i = 0; i < 10; i = i + 1) {
... a = a + 1;
... }
...
...
>>> print(a);
10>>> let a = 13;
>>> if (a <= 10) {
... a = a + 1;
... } elif (15 > a) {
... a = a - 1;
... } else {
... a = 20;
... }
...
>>> print(a);
12>>> fn add(a, b, c) {
... print(a + b + c);
... }
...
>>> add(1, 2, 3);
6>>> fn fact(n) {
... if (n <= 1) {
... return 1;
... }
... return n * fact(n - 1);
... }
...
>>> let x = fact(5);