Crabby
Crabby Programming Language.
Install / Use
/learn @crabby-lang/CrabbyREADME
Crabby: The Modern Programming Language Written in Rust
Introduction

<h3><b>Shout out to these wonderful programmers helping 🩷</b></h3>[!WARNING] Crabby is still under development with new features and bugs being fixed, if you encounter an error then that's OUR fault, and we're still fixing it. Crabby is very new due to the
rewrite updateand is still experiencing bugs and errors. If you want to help out, please do!
They're the reason why this project is still alive!
<table> <tr> <td><a href="https://github.com/grngxd">@grngxd</a></td> <td><a href="https://github.com/Aleksandere84">@Aleksandere84</a></td> <td><a href="https://github.com/jamiw1">@jamiw1</a></td> </tr> <tr> <td><a href="https://github.com/FlameF0X">@FlameFox</a></td> <td>⭐ <a href="https://github.com/DitherDude">@DitherDude</a></td> </tr> </table>Crabby is a modern, high-level, versatile, multi-paradigm, general purpose language, with a hybrid approach! It is designed to be readable, ease-to-use for beginners, and powerful enough for advanced users.
Crabby is leaning into multi-paradigm, supporting paradigms like object oriented and procedural programming. But if you want the functional nature of Crabby, It is still a Functional programming language by default!
As you may notice, Crabby has been through a few stages of rewrites, if you're thinking that it is abandoned, think again! Crabby has been entirely rewritten in Rust, benefitting from its memory safety and type checking!
What's Changed?
- A new Pythonic-style syntax but with a functional approach!
- Runtime & Type checking is in the works!
- Error handling is in the works!
- More features!
Installation
If you are on Linux and wish to use a pre-compiled binary of Crabby, you can skip right to step 4, and use the second option!
[!TIP] For building from source, we highly recommend that you use the nightly version of Rust!
Step 1: Make sure you have git and rust/cargo installed and up-to-date.
git --version
cargo --version
Step 2: Clone the repository.
git clone https://github.com/crabby-lang/crabby.git
Step 3: Build it!
cargo build
Step 4: Test it for yourself!
cargo run examples/example.crab
OR
cd bin
./crabby ../examples/example.crab
Syntax
Crabby's syntax generally resembles Python, but there are some hints of functional programming syntax!
Crabby reserves the .crab and .cb file extensions, but for now only .crab is used!
helloworld.crab:
print("Hello, World!")
example.crab:
let x = 42 // int
let y = 3.14 // float
var z = 10 // You can use the 'var' keyword too!
let message = "Hello, Crabby!"
print(x)
print(y)
print(z)
print(message)
functions.crab:
pub def foo() {
print("Hello!")
}
foo()
arrays.crab:
let numbers: [Int] = [1, 2, 3, 4, 5]
print(numbers[0])
print(numbers[4])
math.crab:
// addition
let x1 = 1
let y1 = 2
// multiplication
let x2 = 4
let y2 = 7
// subtraction
let x3 = 10
let y3 = 3
// division
let x4 = 10
let y4 = 3
print(x1 + y1)
print(x2 * y2)
print(x3 - y3)
print(x4 / y4)
Data Types?
datatypes.crab:
// Lists of Data Types and Types in Crabby
String
Float
Int
bool
null
ifelse.crab:
// if-else statements
let x = true
let y = false
if x {
print("True!")
} else {
print("Nope!")
}
loops.crab:
let x = range(10)
for i in x {
print(i) // Prints it 10 times
}
let y = 10
for i in range(y) {
print(i)
}
structs.crab:
pub struct Person {
name: String,
age: Int,
hobbies: String,
birthday: Date,
}
enums.crab:
pub enum Colors {
Red,
Green,
Pink,
Purple,
Blue,
RGB(r: Int, g: Int, b: Int),
}
matching.crab:
match value {
case 1 => print("one"),
case _ => print("default"),
}
// Match multiple values:
let number = 5
match number {
case 1 | 3 | 5 | 7 => print("This is a odd number"),
case _ => print("Not an odd number")
}
Note: Crabby supports commenting, use // to comment out a code or leave a silly message :3
Speaking of comments, Crabby also support Docstrings!
FEATURES
[!IMPORTANT] Many features listed here are still in development, and may not work or be missing components!
- Asynchronous awaits
- Inheritance and Polymorphism
- Encapsulation
- Composition (rust style)
- Ability to do unsafe code (be careful though)
- Try catch error handling
- Python-style
finallykeyword - Import and exports (W.I.P)
- Anonymous functions (with Lambdas)
- Higher-order Functions
- Pipe Operators (Elixir/Ruby style)
- Type Safety
- Pattern matching with
matchandcase - The use of
externfor using C code foreignkeyword to code FFI related tasks in crabby, see examples for more detail.
Speed
Since Crabby is written in Rust, we make sure Crabby interprets millisecond speeds for benchmarking and testing.
Note that some inaccuracy happens, and that's fine due to the early nature of Crabby, benchmark data updates occur for every Crabby update or patch. Thank you.
time ./crabby ../examples/example.crab
./crabby ../examples/example.crab
0.00s user
0.01s system
21% cpu
0.083 total
cat ../examples/loops.crab
> let x = range(10000) // 10_000
>
> for i in x {
> print(i) // Prints it 10_000 times
> }
time ./crabby ../examples/loops.crab
./crabby ../examples/loops.crab
0.08s user
0.17s system
78% cpu
0.320 total
FAQs
Q: Is Crabby going to be the new Python or Rust?
Not really! This is just a hobby and fun project of mine, doesn't mean it's going to be the next big thing. But i build crabby because i love learning and experimenting how programming languages are made.
Q:What problems Crabby will fix?
I'm going to very honest and be humble on this one, but Crabby will try to fix the problems that languages face like complexity in their syntax and slow runtime/compile time.
Will it happen right now? Not yet, but could be, maybe one day you as the developer reading this could contribute the future of Crabby 😎
Q: Why does it have braces and other non-Pythonic syntaxes if it aims to be one?
Well i didn't say it's going to be FULLY pythonic, there are hints of pythonic style syntaxes but Crabby is multi-paradigm meaning you don't alway expect everything to be fully pythonic. It is great for python users that wants a functional approach language.
Package Manager📦
The closest package manager Crabby can have is crab🦀 (which is still in development),
it functions likely the same as Rust cargo but for Crabby
Community
Want to join the Crabby Community?
Contributing
Crabby is open to contributions! Feel free to open an issue or a pull request. Make sure to read the Contributing Guidelines before getting started.
LICENSE
Crabby is licensed under the GNU General Public License v3.0.
Shout Out!
Shout out to my friend ANW and his modern proglang called the Lunite Programming Language! You might want to check it out!
Old Contributors ✨
Thanks goes to these wonderful people that used to help this project! 👨💻💻:
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tbody> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/Satvik-2727"><img src="https://avatars.githubusercontent.com/u/87568817?v=4?s=100" width="100px;" alt="Mr.Coder"/><br /><sub><b>Mr.Coder</b></sub></a><br /><a href="https://github.com/crabby-lang/crabby/commits?author=Satvik-2727" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/Scarleyegaming"><img src="https://avatars.githubusercontent.com/u/93965392?v=4?s=100" width="100px;" alt="Saturo"/><br /><sub><b>Saturo</b></sub></a><br /><a href="https://github.com/crabby-lang/crabby/commits?author=Scarleyegaming" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://tiramify.dev"><img src="https://avatars.githubusercontent.com/u/94789999?v=4?s=100" width="100px;" alt="Trnx"/><br /><sub><b>Trnx</b></sub></a><br /><a href="https://github.com/crabby-lang/crabby/commits?author=trnxdev" title="Code">💻</a></td> </tr> </tbody> </table>Star History
[](https://www.star-history.com/#crabby-lang/crabby&type=d
