Skip to main content

Crate kain

Crate kain 

Source
Expand description

§KAIN - The Ultimate Programming Language

§Philosophy

  1. Rust’s Safety - Ownership, borrowing, no null, no data races
  2. Python’s Syntax - Significant whitespace, minimal ceremony
  3. Lisp’s Power - Code as data, hygienic macros, DSL-friendly
  4. Zig’s Comptime - Compile-time execution, no separate macro language
  5. Effect Tracking - Side effects in the type system
  6. Actor Concurrency - Erlang-style message passing built-in
  7. Universal Targets - WASM, LLVM native, SPIR-V shaders

§Example

fn factorial(n: Int) -> Int with Pure:
    match n:
        0 => 1
        _ => n * factorial(n - 1)

Re-exports§

pub use lexer::Lexer;
pub use parser::Parser;
pub use error::KainError;
pub use span::Span;
pub use ast::*;
pub use types::*;
pub use effects::*;

Modules§

ast
KAIN Abstract Syntax Tree
codegen
KAIN Code Generation - Multi-target output
comptime
diagnostics
Pretty error reporting for KAIN Shows source context with line numbers and error highlighting
effects
KAIN Effect System - Track side effects at compile time
error
Error types for the KAIN compiler
lexer
KAIN Lexer - Significant whitespace + Rust-like tokens
lsp
monomorphize
packager
parser
KAIN Parser - Python-style indentation with Rust semantics
runtime
KAIN Runtime - Interpreter and actor system
span
Source code span tracking for error reporting
stdlib
KAIN Standard Library
types
KAIN Type System - Rust-like with effect tracking

Enums§

CompileTarget

Constants§

LANGUAGE_NAME
VERSION
Version of the KAIN language

Functions§

compile
Compile KAIN source to the specified target