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 update
and is still experiencing bugs and errors. If you want to help out, please do!
@grngxd | @Aleksandere84 | @mesmerica / luci (discord) | @jamiw1 |
@FlameFox |
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!
- 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!
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
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
let y = 314
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
!
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
finally
keyword - Import and exports (W.I.P)
- Anonymous functions (with Lambdas)
- Higher-order Functions
- Pipe Operators (Elixir/Ruby style)
- Type Safety
- Pattern matching with
match
andcase
- The use of
extern
for using C code foreign
keyword to code non-crabby code inside crabby (can load shared libraries like DLLs/.so files and reuse it)
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 brackets 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.
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
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.
Crabby is licensed under the GNU General Public License v3.0.
Thanks goes to these wonderful people that used to help this project! 👨💻💻:
Mr.Coder 💻 |
Saturo 💻 |
Trnx 💻 |