Calibre is a modern, statically-typed programming language designed for clarity, expressiveness, and extensibility. Built in Rust, Calibre aims to provide a robust interpreted experience, with future plans for JIT compilation via Cranelift and static compilation via LLVM (Inkwell). The language is ideal for both scripting and systems programming, and is designed with tooling in mind: a Tree-sitter grammar, formatter, and LSP support are all part of the roadmap.
- Statically Typed: Type inference and explicit typing for safety and expressiveness.
- Pattern Matching: Powerful match statements for enums and data structures.
- Enums & Structs: Algebraic data types with tuple and hashmap-like variants.
- Immutability by Default:
letfor immutable,let mutfor mutable variables. - First-Class Functions: Functions as values, with concise syntax.
- Modules & Imports: Simple module system for code organization.
- Interpreted Execution: Fast iteration with an interpreter backend.
- Planned AOT Compilation: Cranelift static compilation in development.
- Tooling: Tree-sitter grammar, formatter, and LSP (Language Server Protocol) support planned.
type Language = enum {
FRENCH { data : int, code : int },
ENGLISH (int),
SPANISH,
ARABIC (Language, Language),
}
type Country = struct (Language)
// Immutable variable with inferred type
let language = Language.FRENCH{data : 10, code : 5};
// Mutable variable
let mut recursive_language = Language.ARABIC(language, Language.SPANISH);
// Pattern matching with mutation
recursive_language |> match &mut {
data.Language.ARABIC(Language.FRENCH{_}, Language.ARABIC(Language.FRENCH{code})) => print("Code: " & code),
data.Language.ARABIC(Language.FRENCH{data}, Language.SPANISH) => {
print("Enum: " & data)
data = 5;
print("Enum Changed: " & data)
},
}-
Clone the repository:
git clone https://github.com/CodersCreative/calibre-lang.git cd calibre-lang/cal -
Run a REPL:
cargo run
-
Run an example:
cargo run -- --path ../examples/showcase/main.cl
- Interpreter backend
- Cranelift backend (
crates/cranelift) - Tree-sitter grammar (https://github.com/CodersCreative/tree-sitter-calibre)
- Formatter ('fmt')
- Language Server Protocol (LSP) (
lsp) - Package manager
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
MIT License. See LICENSE for details.
cal/: Main interpreter frontendfmt/: Formatter implementationcrates/: Core language crates (parser, interpreter, JIT, etc.)examples/: Example Calibre programslsp/: Language Server Protocol implementation (in progress)