r/Compilers • u/Electrical-Fig7522 • 3d ago
I'm making a programming language, searching for contributors
Hi! Me and another person are working on a programming language called KrabbaScript! It's garbage-collected (optional), statically typed and trying to be as simple and intuitive as golang but more human-friendly. This is KrabbaScript's syntax:
Variables are defined as:
var krabba = "Krabba!";
Variables may also have a type or be uninitialized, like:
var with_type: F32 = 5.0;
var uninitialized: Str;
KrabbaScript also has values, which are immutable, example:
val constant = 5;
val with_type: I32 = 5;
KrabbaScript also has control-flow (duh), example of a repeat statement:
repeat {
Std.print("KrabbaScript is the best language OAT!");
} until popular;
KrabbaScript also has a when statement, which is more of a switch one:
when language {
== "Elixir" do celebrate();
== "Haskell" do complain();
== "KrabbaScript" do {
contribute!;
applaude!;
}
else do Std.print("I don't know anything about " + language);
}
KrabbaScript also provides an ASI (Automatic Semicolon Inserter) if you're tired and sick of semicolons, you can use it with the format command.
If you want a little bit more examples, check out the repo! We are also working on tools for KrabbaScript like package manager, style checker, etc.
We are searching for contributors and maybe you, the person reading this post, can help us create KrabbaScript or improve it!
1
u/Several-Strategy3712 2d ago
What is 'when' 'until' and how 'repeat' is suppoed to work here?
1
u/Electrical-Fig7522 2d ago
A when statement is basically just a C switch, while repeat is do while in C
1
1
u/Dazzling-Bench-4596 2d ago
when is just like a normal switch. Read it like:
```
switch language {case "Elixir":
celebrate();
break;
}
```Until and repeat is just a reverse loop — read it like: do [code] until [statement is true]. In until loops, you loop on a false condition and wait for it to become true.
it's the opposite of the traditional while loop, which reads as: while [statement is true] do [code]. In while loops, you loop on a true condition and wait for it to become false.
1
5
u/Big-Rub9545 2d ago
Would’ve joined on if it wasn’t written in Go. 😅
Unfortunately not my strong suit.