-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the official Cedrus documentation. Cedrus is a medium-level, statically typed language that balances the power of C++ with the modern safety features of Rust.
Variables are declared using let and constants using const. Type annotations are required after a colon :.
let x: int = 42; // Mutable variable (default)
const PI: float = 3.14; // Immutable constant
let name: string = "Cedrus";
let is_valid: bool = true;Functions are declared using the fn keyword. The main function is the entry point of every Cedrus program.
fn main() {
let result: int = add(10, 5);
print("Result is:", result);
}
fn add(a: int, b: int) int {
return a + b;
}Cedrus currently supports the following primitive types:
| Type | Description | Go Equivalent |
|---|---|---|
int |
Signed 64-bit integer | int64 |
float |
64-bit floating point | float64 |
string |
UTF-8 string | string |
bool |
Boolean (true or false) |
bool |
void |
Empty type (used for return types) | (none) |
Cedrus supports standard conditional branching. Conditions must be wrapped in parentheses ().
if (age >= 18) {
print("Access granted.");
} else {
print("Access denied.");
}-
+(Addition) -
-(Subtraction) -
*(Multiplication) -
/(Division)
-
==(Equality) -
!=(Inequality) -
<(Less than) -
>(Greater than) -
<=(Less than or equal) -
>=(Greater than or equal)
-
!(NOT)
Currently, Cedrus provides basic built-in utilities for I/O:
Prints one or more values to the standard output, followed by a newline.
print("Hello", 123, true);A typical Cedrus project consists of .ced files.
-
cmd/cedrus/: Contains the CLI source code. -
pkg/lexer/: Lexical analysis (tokenization). -
pkg/parser/: Syntactic analysis (AST generation). -
pkg/ast/: Abstract Syntax Tree definitions. -
pkg/compiler/: Transpilation logic (Cedrus -> Go).
Cedrus is in early development. Future releases will include:
- Structs: For custom data models.
-
Loops:
forandwhileconstructs. -
Standard Library:
io,os,net,math, andjsonpackages. - Error Handling: Safe alternatives to panics.