Krait is a fast, memory-safe, and highly productive systems programming language.
Designed under the philosophy "Reduce cognitive noise without reducing power," Krait combines the elegant, indentation-based readability of Python with the raw execution speed and control of C and Rust. It compiles directly to native machine code via a highly optimized LLVM-IR backend.
Krait does not use a garbage collector. Instead, it implements a strict compile-time Ownership Memory Model:
- Move Semantics: Assigning a heap variable (
set a = b) transfers ownership. The compiler invalidatesbat compile time to prevent double-free bugs. - Auto-Drop: When a variable goes out of scope, the compiler automatically generates a native
@freeinvocation to deallocate heap memory, guaranteeing zero memory leaks.
Krait is designed from the ground up for modern AI-assisted engineering and automated workflows:
- Actionable Compiler Diagnostics: Errors are printed as beautifully formatted, descriptive blocks explaining exactly why the bug occurred and presenting multiple concrete code resolutions. LLMs read these diagnostics and can fix code immediately.
- Standard Code Formatter (
krait fmt): Standardizes style and indentation instantly, ensuring generated and human code always align perfectly.
Krait links directly to your native system toolchain with optimal compile-time performance passes:
- Optimal Optimization: Automatically passes
-O3and-flto(Link-Time Optimization) flags to LLVM/Clang. - Broad Hardware Compatibility: Explicitly compiles with
-march=x86-64-v2, making executables blazingly fast and compatible on high-end developer rigs as well as legacy and energy-efficient systems (e.g. Intel Celeron, 10th Gen Core i3 laptops).
- Clean Pythonic Syntax: Indentation-based blocks, minimal punctuation, and low cognitive noise.
- Modular Imports: Split code bases into clean modules and reuse them with recursive
importstatements. - Built-in Package Scaffolding: Scaffold new structures instantly using
krait new. - Stand-alone REPL (IDLE): An interactive shell for fast prototyping and instant calculation.
- Stand-alone Interpreter: Run
.krscripts instantly viakrait runwithout needing a compilation toolchain. - VS Code Extension: Premium, built-in colorizer support.
3d11909 (Release: v1.0.0)
You do not need Cargo or Rust to run Krait. Install the pre-compiled binary directly to your system from the Github releases or install via Terminal:
curl -fsSL https://raw.githubusercontent.com/KraitDev/Krait/refs/heads/main/install.sh | bashirm https://raw.githubusercontent.com/KraitDev/Krait/refs/heads/main/install.ps1 | iexcurl -sL https://raw.githubusercontent.com/KraitDev/Krait/main/install.bat | cmdNote for Native Compilation: While the Krait Interpreter (
krait run) is completely standalone, using thekrait buildcommand to generate optimized hardware executables requiresclangto be installed on your system path.
Launch the interactive environment:
$ krait
Krait 1.0.0 Interactive Shell
Type 'exit' to quit.
>>> set greeting = "Hello, Krait!"
>>> show greeting
"Hello, Krait!"krait new my_app
cd my_app
krait run src/main.krCompile a script to a highly optimized hardware executable:
krait build examples/calculator.kr
./calculatorHere is an example demonstrating Krait's clean syntax, standard imports, FFI functions, and recursive functions:
# examples/test_math.kr
import math
# abs(-42) -> 42
set a = abs(0 - 42)
show a
# power(2, 10) -> 1024
set p = power(2, 10)
show pTo enable official syntax highlighting in VS Code:
- Download the
vscode-krait.zipfile from the repo and extract it. - Copy the extracted
vscode-kraitfolder to your VS Code extensions directory:- Windows:
%USERPROFILE%\.vscode\extensions\ - Mac/Linux:
~/.vscode/extensions/
- Windows:
- Restart VS Code. Your
.krfiles will now be properly colorized!
With the release of v1.0.0, Krait's roadmap is fully realized:
- Phase 1: Prototype Engine (Lexer, Parser, AST, Basic Tree-Walking Interpreter)
- Phase 2: Compiler Backend (LLVM Text IR Generation, Native Linking, Advanced Type Inference)
- Phase 3: Ownership & Auto-Drop (Compile-time Move analysis, Scope-based stack deallocations)
- Phase 4: Ecosystem & Tooling (REPL, Project Manager, Actionable Diagnostics, standard
math/iolibraries,krait fmt)
See CONTRIBUTING
Krait is an open-source project managed by KraitDev. The core compiler, standard libraries, and runtime are dual-licensed under the terms of both the MIT License and the Apache License 2.0.
To protect the integrity of the ecosystem and ensure fair attribution, all users, forks, and contributors are bound by our official project policies:
- Copyright & Ownership: KraitDev retains exclusive ownership of the core Krait codebase. Contributors maintain authorship of their specific code but grant KraitDev a permanent license to distribute it. Review the full fork and attribution boundaries in COPYRIGHT.
- Trademark & Identity: The phrase "Krait Programming Language" and the official logos are protected brand assets. You are fully permitted to use them to brand community tools, libraries, and extensions built for the ecosystem, provided it is clear they are independent creations. Deceptive core forks or commercial passing off are strictly prohibited. Review the full domain boundaries in TRADEMARK.
See LICENSE-MIT and LICENSE-APACHE for the underlying open-source license texts.