Fast
Zero-cost abstractions, value semantics and no garbage collector. Source compiles to C23 and is optimized by mature C compilers.
A programming language for the next generation of computing.
Karkain is an independently developed, statically typed systems programming language. It compiles .kark source to C23 and delegates to GCC, Clang or MSVC for final machine code — built around ownership-based memory safety, native concurrency, and a heterogeneous computing vision spanning CPU, GPU and quantum hardware.
A Karkain program is ordinary text in a .kark file. The compiler reads it, analyzes it, and turns it into a native binary. This exact program was verified against the current Karkain toolchain.
func main() {
print("hello world")
}The .kark extension is canonical in the Karkain project. Tooling, the package manager and the test framework all treat .kark as the source extension.
Karkain is built on four non-negotiable principles. They shape the language, the compiler and the runtime.
Zero-cost abstractions, value semantics and no garbage collector. Source compiles to C23 and is optimized by mature C compilers.
Compile-time ownership and borrow checking. No null pointers, no use-after-free, no data races. Option and Result replace exceptions.
CPU code and GPU compute kernels written in the same .kark file, with quantum circuits targeting OpenQASM and QIR. One language, a spectrum of hardware.
The ultimate goal: karkain compiles itself. No dependency on Go, Rust or any other toolchain for day-to-day development.
A deterministic, multi-stage pipeline. Karkain performs its own lexing, parsing, semantic analysis and optimization; only the final machine-code lowering is delegated to a mature C compiler.
Lexer & Parser
Tokenizes .kark source into a token stream and builds an AST with arena allocation and line tracking.
Semantic analysis
Borrow checking, type checking and macro expansion validate the program before code generation.
SSA IR pipeline
Source lowers to SSA form; constant folding and dead-code elimination run before a verifier checks the result.
C23 → native
The C emitter produces C23, linked with GCC, Clang or MSVC into a native binary.
The CPU path is the production pipeline behind Karkain 1.1. GPU shaders (WGSL, SPIR-V, OpenCL) and quantum circuits (OpenQASM, QIR) are part of the documented architecture and represent the project's heterogeneous direction.
Karkain is designed so that a single .kark program can speak to a spectrum of hardware — not only one architecture.
Compiles to C23 and links with GCC, Clang or MSVC. Full native support with Karkain’s own target-triple model (x86_64, aarch64).
AVX2-aware intrinsics and optimized matrix operations for performance-critical kernels.
A wasm32-wasi target whose module is emitted directly, without an external linker.
Kernel-driven design aiming to emit WGSL, OpenCL and SPIR-V shaders from the same source file.
Gate-level circuits targeted at OpenQASM 3.0 and QIR as part of the long-term heterogeneous architecture.
NPU, FPGA, DPU and neuromorphic-class targets remain long-term research horizons on the project’s abstraction agenda.
Status reflects the Karkain roadmap: what ships today, what is actively being built, and where the project is headed.
Instead of delegating its representation layer to an external compiler framework, Karkain lowers source to its own SSA intermediate representation. The IR pipeline is part of the project and evolves with the language.
Programs can also be emitted as Karkain module bytecode (.kbc) and executed by Karkain's own stack-based VM and JIT engine — a separate execution path from native C23 compilation.
Lowered to SSA form with variable cells and a control-flow graph. Packages: pkg/ir, pkg/codegen/lower.go.
Constant folding and dead-code elimination run on the IR before a verifier checks types and control flow. Packages: pkg/ir/ssa.
Emit C23 and link with GCC/Clang/MSVC, or emit .kbc bytecode and run on the Karkain VM (pkg/jit).
Karkain's ultimate independence goal: karkain compiles itself. A self-hosted front-end written in Karkain is being brought up through a bootstrap path, and it is already the language's default engine.
lexer.kark → parser.kark
ast.kark → atypes.kark
sema.kark → checker.kark
codegen.kark → main.karkBoostrapped through C, the self-hosted front-end then builds Karkain programs by emitting C23 and linking with a system C compiler.
Tokenizes Karkain source, written in Karkain.
Builds the AST from the token stream.
Syntax tree and attribute type definitions.
Type checking and analysis in Karkain.
Emits C23 from the analyzed program.
The Karkain ecosystem grows together: a language, a compiler, a runtime, a standard library, a toolchain and developer tooling.
Static typing, ownership and borrow checking, algebraic data types, pattern matching, and a spec tracked in SPEC.md.
The self-hosted engine lexes, parses, analyzes, optimizes and emits C23.
A concurrency runtime with tasks and channels. No garbage collector. A JIT tier remains planned.
.kark modules for core semantics, strings, collections, I/O, encoding, crypto, math and more.
run, build, check, test, fmt, lint, bench, prof, plus package manager and workspaces.
A language server providing hover and go-to-definition. Some semantic features are not yet provided by the server, and the editor extension is not part of this public repository.
The standard library is written as .kark modules — the same language applications use — and is an active area of development.
Identity, conversions, comparison and fundamental operations over owned types.
Text processing built on owned byte strings.
A growing set of container and algorithm primitives.
Console, filesystem and system-facing operations used by native programs.
Structured encodings for data exchange.
Cryptographic primitives and numerical helpers under active development.
From a first program to a packaged project, the Karkain toolchain is designed around a simple loop.
Write plain .kark source.
Validate syntax and semantics.
Compile to a native executable.
Compile and execute in one step.
*_test.kark files are auto-discovered.
Resolve dependencies, write lockfile, fetch.
Karkain 1.1.0 is a published release. The compiler, language, standard library and toolchain below ship today; further engineering continues after the release, and planned areas are labelled as such rather than presented as available.
| Area | Status | Notes |
|---|---|---|
| Compiler core · Karkain 1.1 | The project’s own release gate passed and version 1.1.0 was published as its release line. Further engineering continues after the release. No independent performance or reliability assessment has been carried out. | |
| Self-hosting | The compiler’s Karkain-written front-end is the default engine and builds Karkain programs today. | |
| Language & core pipeline | The core language and pipeline ship in 1.1.0. Additional type-system features, autodiff and quantum safety remain in development for later phases. | |
| Concurrency runtime | Task model, channels and synchronization primitives ship in 1.1.0. A JIT tier remains planned. | |
| Standard library | Core, string, collections, I/O, encoding, crypto, math and system modules ship in 1.1.0 as .kark. | |
| Cross-compilation | An owned target-triple model covering x86_64, aarch64 and wasm32 over windows, linux and wasi. Running foreign targets is refused for honesty. | |
| Heterogeneous backends | GPU and quantum backends are documented in the compiler architecture and on the roadmap. |
Karkain is one of a family of technologies being engineered by QuantsMind. Explore its neighbors in the ecosystem.
Follow the project on GitHub. The language, the compiler, the standard library and the documentation evolve together — and the repository is the source of truth.
Documentation — the language spec and engineering reports — live in the repository and evolve alongside the language.