Skip to content
المشاريع

حول

A garbage-collected language with a bytecode VM and JIT in C, plus Metal GPU ports of numpy, pandas, OpenCV and a PyTorch-style training library.

لغات البرمجة وبيئات التشغيل

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
جارٍ جمع السجل
خلال 15 يومًا
جارٍ جمع السجل
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل
Jaithon

Jaithon

The best parts of Java merged with python

What Jaithon is

Jaithon is a dynamically executed and garbage collected language with a bytecode VM. It takes heavy insp from the structure from Java (for its architecture) and insp for everything else from a combination of Rust & Python.

Pretty much everything (apart from the CORE primitive implementation stuff) is written in jaithon itself, making it VERY much bootstrapped and easy to extend with new features.

AI Usage

Most documentation within .jai and .c files is currently AI-generated to speed up development, though it is being rewritten as the language evolves. This README, including the language guide, is hand-written, thoroughly reviewed, and currently 100% accurate. Docstrings in the code may still be inaccurate, as they were generated by an LLM.

Additionally, around 80% of the raw code in this repository was produced with agentic coding tools (claude code). My workflow is to first design a feature or bug fix completley by hand, then use an LLM to help either finish it, integrate it with the codebase, catch additioal bugs before I push, improve performance, or correct me on bad assumptions. The resulting code is something I completley understand and something that I stand by, and something that belongs to me.

The architecture is also 100% my own, 100% human generated, and not AI assisted.

I see agent-assisted coding as the future of software engineering. It let me build Jaithon 3 far faster than I could have done alone, while still keeping a real human in the loop for the important decisions. Without agentic coding, Jaithon 3 probably wouldnt have existed, and Jaithon would have been stuck at a primal level. The entire codebase is reviewed by me and I would not consider myself a "vibecoder", or jaithon as "ai slop"; it is collaborative engineering with LLMs used as a multiplier to exponentiate my productivity.

Quick start

git clone https://github.com/abhiramasonny/jaithon
cd jaithon
make                        # builds ./jaithon
make test                   # this is optional, but it runs the benchmarks and tests and stuff
./scripts/install.sh        # also optional, it installs itself to /usr/local

The reqs to run jaithon are a C11 compiler and make, readline is used for the REPL if present. On macOS the Metal and Cocoa frameworks enable the GUI and GPU modules, however everything else builds and runs without them.

jaithon run program.jai     # run a file
jaithon                     # REPL
jaithon check src/          # type-check without running
jaithon fmt .               # canonical formatter, no options
jaithon test                # discover and run tests
jaithon doc --out docs/api  # generate API documentation
jaithon disasm program.jai  # bytecode listing

The REPL keeps its bindings across lines, continues an unfinished input on a ... prompt, and takes meta-commands. :help lists every one of them.

For VS Code, editors/vscode/install.sh packages and installs the extension. It runs the real compiler for diagnostics, navigation, rename, hover and formatting, so the editor never disagrees with jaithon check.

A taste of .jai

# let is immutable but var is not and const is compile time
let name = "Jaithon"
var count = 0
const MAX = 1 << 16

# types are optional, but they are checked if they are present
let ratio: float = 0.5
let names: list[str] = []
let lookup: dict[str, int] = {}
let maybe: int? = null           # T? is T | null

if names.len() > 0 { print(names[0]) }
print(maybe ?? -1)

# loops and ranges
for i in 0..10 { count += i }
'outer: for row in grid {
    for cell in row {
        if cell == target { break 'outer }
    }
}

# pattern matching
let kind = match code {
    200           => "ok",
    301 | 302     => "redirect",
    400..=499     => "client error",
    n if n >= 500 => "server error",
    _             => "unknown",
}

enum Shape {
    Circle(radius: float),
    Rect(w: float, h: float),
}

fn area(s: Shape) -> float {
    return match s {
        Shape.Circle(r)  => math.PI * r ** 2,
        Shape.Rect(w, h) => w * h,
    }
}

# traits are interfaces with default methods, and they are types.
trait Printable {
    fn to_str(self) -> str
    fn describe(self) -> str { return f"<{self.to_str()}>" }
}

# Errors are classes
fn load(path: str) -> str {
    let file = io.open(path, "r")
    defer { file.close() }
    return file.read()
}

# comphressons and lazy iterators.
let squares = [x ** 2 for x in 0..10 if x % 2 == 0]
let first_ten = iter(source).map(parse).filter(is_valid).take(10).collect()

# ML Training
import jaitensor as jt

@trace
fn logits(x: Tensor[float, 32, 10]) -> Tensor[float, 32, 10] {
    return x
}

let model = jt.Sequential([
    jt.Conv2d(16, 3, padding: 1),
    jt.Flatten(),
    jt.Dense(10, activation: jt.Activation.Softmax),
])
model.compile(jt.Adam(), mixed_precision: true)
model.fit(data, epochs: 5, batch_size: 512, shuffle: true)

Language guide

Hello

print("Hello, world!")

Save it as hello.jai and run jaithon run hello.jai.

Comments

# A line comment.

#* A block comment,
   which can span lines. *#

Variables

let is immutable. var is mutable.

let name = "Ada"
var count = 0
count += 1

A type annotation is optional, however when you write one it is enforced by Jaithon.

let pi: float = 3.14159
var total: int = 0

There is one gap, and it is worth knowing exactly where it is. A value routed through any escapes the checker, because with an any receiver the checker does not know the class and so cannot know what a field was declared as. Field writes are checked at run time, so this raises TypeError:

class Point { pub var x: float
              fn init(self, x: float) { self.x = x } }

fn poison(p: any) { p.x = "not a float" }
poison(Point(1.5))          # TypeError: cannot assign str to field 'x' declared float

Container elements are not, so this is currently accepted:

let xs: list[int] = []
fn poison2(l: any) { l.push("str") }
poison2(xs)                 # xs is now ["str"]

Treat a container's element type as checked at the boundaries the checker can see, and not through any.

Types

int, float, bool, str, bytes, and null. Containers are list, dict, set, tuple, and range. The type any accepts anything and is checked when it flows into something more specific.

An int becomes a float where a float is wanted, and the value really is converted:

let temperature: float = 20
print(temperature)          # 20.0

A float never silently becomes an int, because that would lose the fraction. Write int(x) when you want to truncate.

A type argument can be an integer literal. The checker keeps it as a constant, which is how a tensor names its shape:

fn logits(x: Tensor[float, 32, 10]) -> Tensor[float, 32, 10] {
    return x
}

Tensor is a class (jaitensor.Tensor or an import alias), not a builtin. User generics normally drop their arguments; the checker keeps them when the name is Tensor. Two written shapes have to agree, including the dtype in the first slot. Bare Tensor still assigns both ways, which is the escape hatch when the rank is not known yet. Storage is float32, so write float there.

let a: Tensor[float, 2, 3] = t
let b: Tensor[float, 2, 4] = a    # type error: dims 3 and 4

A shape mismatch is a type error at the assignment or return that carries it, not a runtime check. Runtime Tensor.shape can still disagree with the annotation if the value arrived through any.

Strings

let greeting = "Hello"
let name = "Ada"
print(f"{greeting}, {name}!")        # Hello, Ada!
print(f"{2 + 2} and {name.upper()}")  # 4 and ADA

A string prefixed with f interpolates any expression inside braces.

Collections

let numbers = [1, 2, 3]
let ages = {"ada": 36, "alan": 41}
let unique = {1, 2, 2, 3}
let pair = (1, "one")

numbers.push(4)
print(numbers.len())        # 4
print(ages["ada"])          # 36
print(numbers[0])           # 1
print(numbers[-1])          # 4

Comprehensions build them from a loop:

print([x * 2 for x in 0..5])            # [0, 2, 4, 6, 8]
print([x for x in 0..10 if x % 3 == 0]) # [0, 3, 6, 9]
print({x: x * x for x in 1..4})         # {1: 1, 2: 4, 3: 9}

Control flow

let n = 7

if n > 10 {
    print("big")
} elif n > 5 {
    print("medium")
} else {
    print("small")
}

if is also an expression when both arms produce a value:

let label = if n % 2 == 0 { "even" } else { "odd" }

Loops come in three shapes. while tests a condition, loop runs until you break, and for walks a range or a container.

var i = 0
while i < 3 { i += 1 }

for k in 0..3 { print(k) }        # 0 1 2
for k in 0..=3 { print(k) }       # 0 1 2 3
for item in ["a", "b"] { print(item) }

for (index, value) in ["x", "y"].enumerate() {
    print(f"{index}:{value}")
}

A label lets break and continue name which loop they mean:

'outer: for row in 0..5 {
    for col in 0..5 {
        if row * col == 6 { break 'outer }
    }
}

match compares a value against patterns, in order, and returns the first that fits:

fn describe(code: int) -> str {
    return match code {
        200 => "ok",
        301 | 302 => "redirect",
        400..=499 => "client error",
        c if c >= 500 => "server error",
        _ => "unknown",
    }
}

Functions

fn add(a: int, b: int) -> int {
    return a + b
}

Parameters may have defaults, and callers may name them:

fn greet(name: str, greeting: str = "Hello") -> str {
    return f"{greeting}, {name}!"
}

print(greet("Ada"))
print(greet(name: "Grace", greeting: "Hey"))

... collects the rest of the arguments:

fn total(...nums: int) -> int {
    var sum = 0
    for n in nums { sum += n }
    return sum
}

A function that returns nothing is written -> void. A bare return leaves it early.

Lambdas are written with bars, and functions are values:

let square = |x| x * x
let nums = [1, 2, 3, 4]
print(nums.map(|x| x * 10))
print(nums.filter(|x| x % 2 == 0))
print(nums.reduce(0, |acc, x| acc + x))

A closure captures a var by reference and a let by value:

fn make_counter() -> fn() -> int {
    var count = 0
    return fn() -> int {
        count += 1
        return count
    }
}

A function can carry @name decorators. They are part of the function object, not comments.

@trace is for hot numerical kernels. The JIT compiles that function after 8 calls instead of 64. While it runs, std.trace.record_op can record op names and shapes; a later call with the same sequence of shapes sets std.trace.is_replay(). The outermost @trace function owns the graph. is_replay() is a flag for libraries to skip rebuilding a plan; it does not skip the interpreter by itself. A tail call from a traced function does not reuse the frame, so the trace session is still closed on return.

import std.trace as trace

@trace
fn step(x: Tensor, w: Tensor) -> Tensor {
    trace.record_op("matmul", x.shape)
    return matmul(x, w)
}

@gpu_kernel and @mps_graph are the same flag. They mark a function as a device kernel. std.gpu.is_gpu_kernel(f) is how you ask. Compiling Metal still goes through gpu.Kernel.compile(source, entry) with MSL source. The Jaithon body is not lowered to Metal yet.

import std.gpu as gpu

const SAXPY = """
#include <metal_stdlib>
using namespace metal;
kernel void saxpy(device float *x [[buffer(0)]],
                  device float *y [[buffer(1)]],
                  constant int &n [[buffer(2)]],
                  uint i [[thread_position_in_grid]]) {
    if (i < uint(n)) y[i] = y[i] + x[i];
}
"""

@gpu_kernel
fn saxpy(x: gpu.Buffer, y: gpu.Buffer) -> void {
    let k = gpu.Kernel.compile(SAXPY, "saxpy")
    k.dispatch([x, y], x.count, scalars: [x.count])
}

A name that is not trace, gpu_kernel, or mps_graph is stored and currently ignored.

Classes

Fields are declared. pub makes a member visible outside the class; without it the member is private.

class Point {
    pub var x: float
    pub var y: float

    fn init(self, x: float, y: float) {
        self.x = x
        self.y = y
    }

    pub fn length(self) -> float {
        return (self.x ** 2 + self.y ** 2) ** 0.5
    }

    pub static fn origin() -> Point {
        return Point(0.0, 0.0)
    }
}

let p = Point(3.0, 4.0)
print(p.length())        # 5.0
print(Point.origin())

Methods named __add__, __eq__, __str__ and friends give a class its behaviour under operators and print.

A class inherits with extends, and the subclass calls super to run the parent's initialiser:

class Animal {
    pub var name: str

    fn init(self, name: str) { self.name = name }

    pub fn speak(self) -> str { return "..." }
}

class Dog extends Animal {
    pub var breed: str

    fn init(self, name: str, breed: str) {
        super(name)
        self.breed = breed
    }

    pub fn speak(self) -> str { return "Woof" }
}

Traits

A trait states what a type must provide, and may supply defaults.

trait Shape {
    fn area(self) -> float

    fn name(self) -> str { return "shape" }
}

class Circle: Shape {
    var radius: float

    fn init(self, radius: float) { self.radius = radius }

    fn area(self) -> float { return 3.14159 * self.radius ** 2 }
}

Enums

enum Color { Red, Green, Blue }

fn hex_of(c: Color) -> str {
    return match c {
        Color.Red => "#ff0000",
        Color.Green => "#00ff00",
        Color.Blue => "#0000ff",
    }
}

A variant can carry data, which match takes apart:

enum Expr { Num(value: float), Add(left: Expr, right: Expr) }

fn eval(e: Expr) -> float {
    return match e {
        Expr.Num(v) => v,
        Expr.Add(l, r) => eval(l) + eval(r),
    }
}

Every enum value answers ordinal(), the variant's position in its declaration counted from zero. It is what makes a table indexed by variant possible where a match chain would compare one variant at a time:

enum Op { Add, Sub, Mul }
let symbol = ["+", "-", "*"]
symbol[Op.Mul.ordinal()]        # "*"

A method the enum declares with the same name takes precedence.

Errors

throw raises, try and catch handle. A handler catches subclasses too.

fn parse_positive(text: str) -> int {
    let parsed = text.to_int()
    if parsed == null { throw ParseError(f"not a number: {text}") }
    let n = parsed ?? 0
    if n <= 0 { throw ValueError(f"expected a positive number, got {n}") }
    return n
}

try {
    print(parse_positive("42"))
    print(parse_positive("-1"))
} catch e: ValueError {
    print(f"ValueError: {e.message}")
}

defer runs a block when the enclosing function leaves, whether it returns normally or throws. Deferred blocks run in reverse order. A defer inside a loop registers once per iteration, and each one sees that iteration's locals.

fn with_cleanup() {
    defer { print("second") }
    defer { print("first") }
    print("body")
}

?? supplies a value when the left side is null:

let maybe: int? = null
print(maybe ?? 0)        # 0

Every compile error is in this format, so hopefully its easy to debug

error[E0301]: cannot assign to immutable binding `x`
  --> examples/demo.jai:7:5
   |
 5 | let x = 1
   |     - `x` declared immutable here
 ...
 7 |     x = 2
   |     ^^^^^ assignment to immutable binding
   |
help: change the declaration to `var x = 1`

These are what the codes mean:

Code Area
E00xx lexical
E01xx syntax
E02xx names
E03xx bindings
E04xx types
E05xx match
E06xx functions
E07xx classes
E08xx modules

Modules

Every file is a module. pub decides what leaves it.

import std.math
from std.math import sqrt
import std.collections as coll

A leading dot imports relative to the current file:

import .helpers
from .helpers import format_row

GPU

std.gpu is the language's GPU: device buffers, Metal kernels, and the vector ops most programs want. Every operation also has a CPU path for when there is no device.

A Buffer holds float32 slots on the device. Device memory is not garbage collected; call free (usually from defer). set_device has to run before the first buffer or kernel is created. After that the process keeps that device.

import std.gpu as gpu

if gpu.is_available() {
    gpu.set_device(0)
    let buf = gpu.Buffer(1024)
    defer { buf.free() }
    gpu.set_mixed_precision(true)
}

gpu.device_count() is how many Metal devices the process can see. gpu.set_mixed_precision is the device-level float16 flag the native graphs read; jaitensor sets it for you from jt.set_matmul_precision, its one precision switch. Storage stays float32.

Kernel.compile interns by source and entry name. Freeing an interned kernel and compiling the same source again recompiles it.

Machine learning

Training is ordinary Jaithon. jaitensor is a workspace package written in .jai: GPU-resident tensors, autograd, Keras-style Sequential models, and the ops a CNN or attention block needs. It queues Metal through std.gpu and marks its hot kernels @trace.

import jaitensor as jt

let data = jt.Dataset.from_rows([[0.0, 1.0], [1.0, 0.0]], [0, 1])
defer { data.free() }

let model = jt.Sequential([
    jt.Dense(128, activation: jt.Activation.Relu),
    jt.Dense(10, activation: jt.Activation.Softmax),
])
defer { model.free() }

model.compile(jt.Adam(), mixed_precision: true)
model.fit(data, epochs: 5, batch_size: 2048, shuffle: true)

Images are NHWC. Layers include Dense, Conv2d, Flatten, BatchNorm2d, GroupNorm2d, LayerNorm, MultiHeadAttention, Dropout, Embedding, MaxPool2d, and AvgPool2d. Activations include ReLU, GELU, SiLU, and leaky ReLU. DataLoader can shuffle by gathering rows on the GPU. fit(..., shuffle: true) uses that path. Tensor ops cover the PyTorch-style surface: abs, sum/mean, clamp, cat, pooling, dropout, mse, eye, flip, nearest upsample, tril, and binary_cross_entropy_with_logits. Embedding gathers rows and scatters gradients back into the table. MultiHeadAttention with heads > 1 uses a tiled flash kernel on long sequences (head_dim <= 64) so the score matrix never hits device memory; other shapes use MMA/MPS GEMM.

compile(..., mixed_precision: true) trains with float16 products, float32 weights, optimizer state and accumulation, and dynamic loss scaling on the compiled, static and autograd routes (model.loss_scaler() reports the scale and skipped steps); the hand-fused MLP routes run float16 unscaled. The setting is process-wide and later compile() calls without the argument keep it. In a hand-written loop, jt.set_matmul_precision("fp16") and a jt.LossScaler (scaler.backward(loss), then scaler.step(optimizer, params, max_norm: 1.0) once a step, which unscales, clips and skips on the device through fused_step) do the same; set_matmul_precision("bf16", backward: "bf16") keeps float32's range and needs no scaling.

In half precision, attention trains on one of three routes per shape: the float32 kernels, half GEMMs around a float32 softmax, or fused flash kernels. A static rule picks until the shape has run often enough to pay for a timing pass, and the measured winner is cached in ~/.cache/jaithon/attention-routes.tsv.

optimizer.step updates every parameter in one kernel launch. A dense stack (Flatten then Dense layers, sparse cross-entropy, SGD, momentum or Adam) trained by fit is recorded once as a run of jaitensor's own kernels and replayed per batch, which takes most of the encoding cost off a small step.

A model runs where it is fastest. std.device is the one scheduler for the CPU (Accelerate), the GPU (Metal) and the neural engine (Core ML): it knows what each device has queued and what a product or a chain costs on each. fit, evaluate and predict ask it once per call, so a small model whose answer the host wants runs whole on the CPU through std.gpu.host (BLAS on the matrix units) instead of waiting on the GPU queue. predict(x, device:) takes "gpu", "ane", "cpu" or "auto" (the default, or whatever JAITHON_INFER_DEVICE names). "auto" exports the model as a Core ML program when it pays, times it on each device, and keeps the fastest; the neural engine answers in half precision, so strict: true keeps the GPU's float32 result. Compiled programs are cached in ~/.cache/jaithon/coreml. jaicv.dnn plans route the same way.

jainum defers elementwise ops and fuses a chain of them into one Metal kernel the next time anything else touches the device. Small products, folds and the LAPACK factorizations (svd, qr, eigh, eig, solve) run on the CPU through Accelerate.

A tensor that you allocate yourself needs free. Models and datasets free the tensors they own.

The VM is single-threaded. Closures cannot run on std.thread workers, so the loader overlaps the next gather with GPU work on the same Metal queue rather than on a host prefetch thread.

set_device / device_count pick which GPU later allocations use. There is no built-in all-reduce.

Packages

Libraries that ship outside the standard library live under packages/. Each one has the same layout:

packages/name/
├── jaithon.package.json    version and dependencies (exact or caret ranges)
├── src/name/               the public module has the package's name
└── tests/

jaithon.workspace.json lists the members. The runtime adds each package's src to the import path, from a checkout or from an installed share/jaithon/packages. Run make package-check after changing a manifest.

Package What it is
jaitensor GPU-first training: Metal-resident tensors, autograd, a Keras-style Sequential API, dense, conv, norm and attention layers, fp16 and bf16 mixed precision, a GPU DataLoader, SGD and Adam, JSON weight files, inference routed to the CPU or the neural engine when they are faster
jainum n-dimensional arrays with numpy's API on the GPU: strided NDArray over a Metal buffer, broadcasting, ufuncs, reductions, sorting, linear algebra, FFTs, random numbers, statistics. Indexing takes an int, a range, a Slice or a sentinel rather than slice syntax
jaiframe columnar data frames with pandas' API on the GPU: nullable Column lanes, one Index class, group-by, joins, reshaping, timeseries, CSV and JSON. Integers and timestamps are exact to 48 bits; text is dictionary-encoded
jaicv computer vision with OpenCV's API on the GPU: Mat, imgproc, codecs, camera capture, contours, features, optical flow, calibration, classical ML, an ONNX importer. About seven hundred recorded cases are replayed against real OpenCV
jaisci scientific computing with scipy's API: optimisation, curve fitting, linear programming, quadrature, ODEs, interpolation, signal, sparse solvers, distributions, spatial structures. Host math in float64, device math in float32
jailearn classical machine learning on the GPU: estimators, model selection, metrics
jaiplot Matplotlib-style figures and axes with file and window backends
jaitoml, jaiyaml TOML 1.0 and YAML 1.2 reading and writing with tomllib's and PyYAML's APIs

Examples

Everything in examples/ runs from a clean checkout and generates its own data, except story_chat (needs TinyStories and DailyDialog in ~/Developer/datasets) and yolo_detect (downloads a YOLOv8 ONNX model).

jaithon run examples/raytracer.jai
jaithon run examples/motion_tracker/track.jai
Example What it shows
hello.jai, raytracer.jai the language with no libraries
calculator.jai, snake.jai std.gui
plot.jai jaiplot figures
mnist_gpu.jai, fashion_mnist.jai the shortest end-to-end training loops
iris_classifier.jai, moons_classifier.jai, sine_regression.jai, spiral_classifier.jai CSV input, jaiplot output, regression, saving and loading weights
neat_snake.jai neuro-evolution with no jaitensor at all
tiny_lm/ a character language model
source_gpt/ a byte-level GPT trained on this repository's own source, sampled through a KV cache
story_chat/ a 27M-parameter GPT you can talk to: BPE tokenizer, pretraining, dialogue fine-tuning, a terminal chat
digit_trainer/ jaicv draws digits, jaitensor learns them
cifar_resnet/ ResNet-20 on CIFAR-10
camera.jai, motion_tracker/, doc_scanner/, yolo_detect/ camera capture, optical flow, a document scanner pipeline, ONNX object detection

How it is built

source --> lexer --> parser --> resolver --> type checker --> codegen --> VM
            |         │           │              │               │         │
          tokens     AST      symbols +      types +          bytecode   values
                               slots          shapes          + JIT      + GC
                                              + casts         + @trace   + GPU
src/          the C core: what cannot be written in Jaithon
  common/       diagnostics and the allocator
  vm/           values, the interpreter loop, the collector
    object/       heap object types
    bytecode/     chunks, the .jaic container, the verifier
    jit/          the arm64 compiled tier
    trace/        @trace instrumentation
  runtime/      builtin functions by family, the module loader
  native/       Metal, CoreML, camera and Cocoa (apple/), processes and threads (posix/)
  cli/          argument parsing, the REPL, the subcommands
lib/
  jaithon/      the compiler front end, written in Jaithon
  std/          the standard library
boot/         the precompiled front end the binary starts from
packages/     workspace packages
tests/        golden, unit, error, REPL, VM and benchmark suites
scripts/      run_tests.sh, gates (gate/), benchmarks (bench/), dev tools (dev/)
mk/           Makefile pieces, one per subject
editors/      the VS Code extension

Dependencies in src/ run downward: common → vm → runtime → native → cli. src/layers.manifest records every allowed edge and make layer-check enforces it. The Makefile finds sources by directory glob, so a new .c file in an existing directory needs no Makefile change. On an arm64 Mac the .m files are built into three dylibs (gpu, gui, camera) that the core loads the first time a program calls into one.

The bootstrap seed

The compiler in lib/jaithon/ has to run before there is a compiler, so the binary carries a precompiled image of it in boot/seed.bin. Only the modules in boot/seed.manifest come from the seed; the rest of lib/std and every package compile from source on first use and are cached in __jaicache__.

  • Editing a seeded file does nothing until make reseed.
  • A seeded module may only import seeded modules, or the tree cannot compile and boot/ has to be restored from git. make seed-closure-check catches this.
  • A change to the emitter needs two reseeds, and make reseed checks that a third is byte-identical.
  • The seed is tied to the build. Never copy boot/ between trees; copy the source and reseed.

Contributing

make debug            # -O0 -g, assertions on
make check            # type-check the whole tree
make test             # every gate, unit binary and suite
make fmt              # format lib, tests, examples and packages
make bench            # language benches against python3, c++ and java
make asan             # the suite on an AddressSanitizer build (make ubsan for UBSan)
make jit-census       # how much of a fixed corpus still runs interpreted, and why
make help             # the rest

make test runs the gates in scripts/gate/, the C unit binaries in tests/vm/, scripts/run_tests.sh (bytecode verifier, golden output diffs at every -O level, unit tests, expected diagnostics, REPL transcripts, format check), a smoke run of every benchmark, and the unit suites under GC stress.

The suite is chosen, not accumulated. scripts/dev/test_select.py measures what each check covers (C lines and Jaithon functions) on a coverage build, keeps a small set by greedy set cover, and deletes the rest. scripts/dev/test_keep.txt is the last selection and scripts/dev/test_force.txt lists the checks it always keeps. Concurrent builds must not share a build tree: pass both BUILD_ROOT=build-x TARGET=jaithon-x.

License

MIT. See LICENSE.

Created by Abhirama Sonny.

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…