Skip to content

Repository files navigation

KernRift

A kernel-first systems language that turns OS invariants into compile-time errors — not boot-time crashes.

Generic systems languages don't model kernel reality. KernRift bakes interrupt contexts, lock ordering, MMIO semantics, and capability requirements directly into the type system. Invalid kernel behaviour fails at compile time.

Features

  • Context safety — functions are annotated with allowed execution contexts (boot, thread, irq, nmi); invalid call edges are rejected
  • Lock ordering — deadlock cycles are detected and rejected at compile time
  • MMIO correctness — hardware register access is typed and volatile-safe
  • Capability gating — privileged operations require explicit module capability declarations
  • Effect tracking — allocation, blocking, and yield in disallowed paths are compile errors
  • Signed artifacts — contracts can be hashed and signed with Ed25519 for supply-chain verification
  • Self-contained toolchain — produces native ELF, PE, and Mach-O executables without cc, ld, or ar
  • Port I/O intrinsicsinb/outb/inw/outw/ind/outd built into the language for x86_64 hardware access
  • Built-in host functionswrite, alloc, dealloc, getenv, exec, exit, str_copy, str_cat, str_len available without extern fn declarations
  • Slice indexingbuf[i] syntax for array element read and write

Install

Platform One-liner
Linux bash <(curl -sSf https://raw.githubusercontent.com/Pantelis23/KernRift/main/scripts/install-linux.sh)
macOS bash <(curl -sSf https://raw.githubusercontent.com/Pantelis23/KernRift/main/scripts/install-macos.sh)
Windows cargo install --git https://github.com/Pantelis23/KernRift kernriftc --locked; cargo install --git https://github.com/Pantelis23/KernRift kernrift --locked (after installing rustup)
All (prebuilt) See Releases

See Getting Started for manual install and prebuilt binaries.

Quickstart

# Write a kernel function
cat > hello.kr << 'EOF'
@ctx(thread, boot)
fn entry() {
    print("Hello, World!\n")
}
EOF

# Compile — produces a fat binary (x86_64 + ARM64 slices)
kernriftc hello.kr
# → hello.krbo  (KRBOFAT fat binary, LZ4-compressed)

# Run — kernrift detects the host architecture and executes the right slice
kernrift hello.krbo

# Or just analyse (no binary output)
kernriftc check hello.kr

Documentation

Doc Description
Getting Started Install, first program, full command reference
Language Reference Complete syntax and type system
Architecture Compiler pipeline and design decisions
Contributing Build, test, crate map, PR checklist
Changelog Release history

Testing

Run the default repo-owned local-safe validation path on 32 GB class machines:

bash tools/validation/local_safe.sh

For the heavier local hir coverage and per-crate serialized test steps closer to the CI-style path:

bash tools/validation/full_serial.sh

Status

KR0–KR3 (facts-only pipeline + artifact emission, driver subset, kernel module, real OS integration) are complete. The compiler is now fully self-contained — it produces native executables for Linux, macOS, and Windows (x86_64 + AArch64) without any external compiler, assembler, linker, or archiver. See KR0_KR3_PLAN.md for the roadmap.

License

MIT © 2025 Pantelis Christou — see LICENSE for the full text.

About

No description, website, or topics provided.

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages