Add native std facades, fix ASCII lowercase and move site examples

Portable standard facades for byte text, environment, timers, randomness,
mapped files, streams, worker pools, directory trees and threads; full ASCII
lowercase in std/unicode; examples move to examples/ with generated site
pages; Go output handles mixed-width slice bounds.
This commit is contained in:
waozi committed 2026-11-12 19:15:45 -03:00
1 parent bb89cbe24b
commit 10e854af6b
51 files changed
+449 -25

No files matched your search

+4 -1
View File
@@ -9,7 +9,7 @@ name: Publish website
on:
push:
branches: [master]
paths: ['site/**', 'web/playground.c', 'web/bundle.c', 'scripts/build_playground.zi', 'scripts/site_target*', 'scripts/site_library_targets.py', 'scripts/benchmark_samples.py', 'tests/site_targets.sh', 'cmd/zir/**', 'cmd/package*.zi', 'cmd/compiler_*.zi', 'bootstrap/**', 'std/**', 'Makefile', '.github/workflows/site.yml']
paths: ['examples/**', 'site/**', 'web/playground.c', 'web/bundle.c', 'scripts/build_playground.zi', 'scripts/site_target*', 'scripts/site_library_targets.py', 'scripts/benchmark_samples.py', 'tests/site_targets.sh', 'cmd/zir/**', 'cmd/package*.zi', 'cmd/compiler_*.zi', 'bootstrap/**', 'std/**', 'Makefile', '.github/workflows/site.yml']
workflow_dispatch:
concurrency:
@@ -43,6 +43,9 @@ jobs:
- name: Build the browser playground
if: steps.credentials.outputs.present == 'true'
run: |
rm -rf site/examples
mkdir site/examples
cp examples/*.zi site/examples/
make -j2 all
build/bin/ziran run --target=c scripts/build_playground.zi
node tests/playground_runtime.cjs
+4
View File
@@ -4,6 +4,10 @@
- Go output compiles `VecSlice` and slice bounds of mixed integer widths, such as `s16` and `s32` indices.
- Fix full lowercase for ASCII A-Z in `std/unicode`; both allocating and caller-owned paths now preserve the existing Unicode conformance contract.
- Add portable native standard facades for byte text, environment access, timers, secure randomness, mapped files, standard streams, worker pools, directory trees and threads. Platform backends remain private implementation seams behind one import.
- Add an opt-in revision-28 ZX executable container to the experimental
direct backend. `zi2asm --emit zx` stores verified lowered instructions;
`--input zx` inspects, re-emits or runs stripped files through the
+1 -1
View File
@@ -24,7 +24,7 @@ You need Make, a C11 compiler, and GNU binutils. From the repository root:
```sh
make
build/bin/ziran run site/examples/hello.zi
build/bin/ziran run examples/hello.zi
```
This prints `Hello, World!`. To install the `ziran` command for your user, run
+6
View File
@@ -9,6 +9,12 @@ removed redundant scripts; those fixtures remain in Git history. Run
## Working now
- Native C programs can import portable standard facades for common platform
services. `std/thread` selects pthreads or native Windows threads while
preserving one `Thread` API; `std/byte_text`, `std/environment`,
`std/timer`, `std/random`, `std/mapped_file`, `std/stdio`,
`std/parallel` and `std/file_tree` similarly hide native-backend modules.
- `std/simd` vector types and operations run with identical bits in native
C (GCC and Clang vectors with SSE2, SSSE3, SSE4.1, AVX2 and NEON
intrinsics, or the lane loops TinyCC and other compilers use), Go lane
+21
View File
@@ -0,0 +1,21 @@
// Arrays and slices: a fixed array, a view into part of it, and a sum.
Sum :: (numbers: []s32) -> s32 {
total: s32 = 0;
for numbers { total += it; }
return total;
}
main :: () {
empty: [5]s32;
print("empty: % % % % %\n", empty[0], empty[1], empty[2], empty[3], empty[4]);
numbers := s32.[1, 2, 3, 4, 5];
numbers[4] = 100;
print("set: %, count: %\n", numbers[4], numbers.count);
middle := numbers[1:4];
print("middle has % items starting with %\n", middle.count, middle[0]);
print("sum of all: %\n", Sum(numbers[:]));
print("sum of middle: %\n", Sum(middle));
}
+32
View File
@@ -0,0 +1,32 @@
// if/else and switch.
Describe :: (number: s32) -> string {
if number < 0 {
return "negative";
} else if number == 0 {
return "zero";
}
return "positive";
}
DayKind :: (day: s32) -> string {
if day == {
case 6; return "weekend";
case 7; return "weekend";
}
return "weekday";
}
main :: () {
print("-4 is %\n", Describe(-4));
print("0 is %\n", Describe(0));
print("9 is %\n", Describe(9));
if 7 % 2 == 0 {
print("7 is even\n");
} else {
print("7 is odd\n");
}
print("day 3 is a %\n", DayKind(3));
print("day 6 is a %\n", DayKind(6));
}
+15
View File
@@ -0,0 +1,15 @@
// defer runs a statement when its scope ends, last deferred first.
Work :: (name: string) {
print("open %\n", name);
defer print("close %\n", name);
print("use %\n", name);
}
main :: () {
defer print("done\n");
Work("file");
{
defer print("leave the block\n");
print("inside the block\n");
}
}
+21
View File
@@ -0,0 +1,21 @@
// Enums: named values and a switch over them.
Shape :: enum {
CIRCLE;
SQUARE;
TRIANGLE;
}
Corners :: (shape: Shape) -> s32 {
if shape == {
case .CIRCLE; return 0;
case .SQUARE; return 4;
case .TRIANGLE; return 3;
}
return -1;
}
main :: () {
print("a circle has % corners\n", Corners(.CIRCLE));
print("a square has % corners\n", Corners(.SQUARE));
print("a triangle has % corners\n", Corners(.TRIANGLE));
}
+14
View File
@@ -0,0 +1,14 @@
// FizzBuzz: multiples of 3 print Fizz, of 5 Buzz, and of both FizzBuzz.
main :: () {
for number: 1..20 {
if number % 15 == 0 {
print("FizzBuzz\n");
} else if number % 3 == 0 {
print("Fizz\n");
} else if number % 5 == 0 {
print("Buzz\n");
} else {
print("%\n", number);
}
}
}
+26
View File
@@ -0,0 +1,26 @@
// Functions: plain calls, default and named arguments, and recursion.
Add :: (a: s32, b: s32) -> s32 {
return a + b;
}
Greet :: (name: string, greeting: string = "Hello") {
print("%, %!\n", greeting, name);
}
Factorial :: (n: s64) -> s64 {
if n <= 1 { return 1; }
return n * Factorial(n - 1);
}
Fibonacci :: (n: s32) -> s32 {
if n < 2 { return n; }
return Fibonacci(n - 1) + Fibonacci(n - 2);
}
main :: () {
print("1 + 2 = %\n", Add(1, 2));
Greet("Ziran");
Greet("world", greeting = "Goodbye");
print("10! = %\n", Factorial(10));
print("fibonacci(20) = %\n", Fibonacci(20));
}
+7
View File
@@ -0,0 +1,7 @@
main :: () {
name := "Ziran";
year: s32 = 2026;
print("Hello, %! It is %.\n", name, year);
print("% + % = %\n", 40, 2, 40 + 2);
print("pi is about %, and 100%% sure\n", 3.14159);
}
+3
View File
@@ -0,0 +1,3 @@
main :: () {
print("Hello, World!\n");
}
+23
View File
@@ -0,0 +1,23 @@
// Loops: while, ranges, collections, break, and continue.
main :: () {
index: s32 = 1;
while index <= 3 {
print("while %\n", index);
index += 1;
}
for step: 0..2 {
print("range %\n", step);
}
fruits := string.["apple", "banana", "cherry"];
for fruit, position: fruits {
print("% is at %\n", fruit, position);
}
for number: 0..9 {
if number % 2 == 0 { continue; }
if number > 7 { break; }
print("odd %\n", number);
}
}
+16
View File
@@ -0,0 +1,16 @@
// The Sieve of Eratosthenes: cross out every multiple of each prime.
LIMIT :: 50;
main :: () {
composite: [LIMIT + 1]bool;
for number: 2..LIMIT {
if composite[number] { continue; }
print("% ", number);
multiple := number * number;
while multiple <= LIMIT {
composite[multiple] = true;
multiple += number;
}
}
print("\n");
}
+13
View File
@@ -0,0 +1,13 @@
Score :: struct {
value: s32;
bonus: s32;
}
Total :: (score: Score) -> s32 {
return score.value + score.bonus;
}
Answer :: () -> s32 {
score: Score = Score.{value = 40, bonus = 2};
return Total(score);
}
+37
View File
@@ -0,0 +1,37 @@
// Structs: records with fields, passed and returned by value.
Point :: struct {
x: s32;
y: s32;
}
Rectangle :: struct {
origin: Point;
width: s32;
height: s32;
}
Area :: (shape: Rectangle) -> s32 {
return shape.width * shape.height;
}
Grow :: (shape: Rectangle, amount: s32) -> Rectangle {
grown := shape;
grown.width += amount;
grown.height += amount;
return grown;
}
main :: () {
corner := Point.{x = 3, y = 4};
print("point: (%, %)\n", corner.x, corner.y);
box := Rectangle.{origin = corner, width = 10, height = 5};
print("area: %\n", Area(box));
box = Grow(box, 2);
print("grown: %x% with area %\n", box.width, box.height, Area(box));
copy := box;
copy.width = 1;
print("the copy is % wide, the original still %\n", copy.width, box.width);
}
+18
View File
@@ -0,0 +1,18 @@
// Strings: length, bytes, slices, and comparison.
CountByte :: (text: string, wanted: u8) -> s32 {
found: s32 = 0;
for byte: text {
if byte == wanted { found += 1; }
}
return found;
}
main :: () {
word := "banana";
print("% has % bytes\n", word, word.count);
print("the first byte is %\n", word[0]);
print("it contains % a's\n", CountByte(word, #char "a"));
print("its middle is %\n", word[1:5]);
print("equal to \"banana\": %\n", word == "banana");
print("equal to \"apple\": %\n", word == "apple");
}
+8
View File
@@ -0,0 +1,8 @@
#import "text"
Answer :: () -> s32 {
if StartsWithFoldASCII("Ziran", "zi") {
return 1;
}
return 0;
}
+9
View File
@@ -0,0 +1,9 @@
// Values: integers, floats, booleans, and text.
main :: () {
print("text: %\n", "ziran");
print("1 + 1 = %\n", 1 + 1);
print("7.0 / 3.0 = %\n", 7.0 / 3.0);
print("true and false: %\n", true && false);
print("true or false: %\n", true || false);
print("not true: %\n", !true);
}
+21
View File
@@ -0,0 +1,21 @@
// Variables and constants: a declared type, an inferred type, a default
// zero value, and a compile-time constant.
LIMIT :: 100;
main :: () {
greeting: string = "initial";
print("%\n", greeting);
first: s32 = 1;
second: s32 = 2;
print("% %\n", first, second);
ready := true;
print("%\n", ready);
count: s32;
print("% (a variable starts at zero)\n", count);
fruit := "apple";
print("% and the limit is %\n", fruit, LIMIT);
}
+1 -1
View File
@@ -61,7 +61,7 @@ def main():
args = parser.parse_args()
repo = Path(__file__).resolve().parent.parent
seeds = [path.read_bytes() for pattern in ("site/examples/*.zi", "cmd/*.zi", "std/*.zi",
seeds = [path.read_bytes() for pattern in ("examples/*.zi", "cmd/*.zi", "std/*.zi",
"tests/fuzz/*.zi")
for path in sorted(repo.glob(pattern)) if path.stat().st_size < 20000]
seed = args.seed if args.seed is not None else time.time_ns()
+4 -4
View File
@@ -4,7 +4,7 @@
Everything listed here is produced from source, so a new module, package or
guide document appears on the next run without editing HTML by hand:
site/examples.html every program in site/examples with the output the
site/examples.html every program in examples/ with the output the
portable runner prints for it;
site/modules.html the index of every standard module and every
public ziranlang package, with summary and status;
@@ -45,7 +45,7 @@ except ImportError: # pragma: no cover - reported at run time
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SITE = os.path.join(REPO, 'site')
EXAMPLES = os.path.join(SITE, 'examples')
EXAMPLES = os.path.join(REPO, 'examples')
STD = os.path.join(REPO, 'std')
DOCS = os.path.join(REPO, 'docs')
ORIGIN = 'https://ziran-lang.org'
@@ -163,9 +163,9 @@ def example_sections(ziran):
summary = EXAMPLE_TITLES.get(name, comment)
title, _, description = summary.partition(': ')
if not description:
sys.exit(f'site/examples/{name}.zi needs a "// Title: description" first comment')
sys.exit(f'examples/{name}.zi needs a "// Title: description" first comment')
entry = 'main' if re.search(r'^main :: \(\)', source, re.M) else 'Answer'
path = f'site/examples/{name}.zi'
path = f'examples/{name}.zi'
options = ['--entry', f'{name}:{entry}'] if entry != 'main' else []
output = run([ziran, 'run', *options, path])
entry_option = f' --entry {name}:{entry}' if options else ''
+5 -5
View File
@@ -58,11 +58,11 @@ OUTPUT_ORACLES = {
def fixtures():
return [
('score', 'Records & calls', 'site/examples/score.zi', 42),
('text_demo', 'Text & imports', 'site/examples/text_demo.zi', 1),
('arrays', 'Arrays & slices', 'site/examples/arrays.zi', 0),
('enums', 'Enums & branches', 'site/examples/enums.zi', 0),
('loops', 'Loops & collections', 'site/examples/loops.zi', 0),
('score', 'Records & calls', 'examples/score.zi', 42),
('text_demo', 'Text & imports', 'examples/text_demo.zi', 1),
('arrays', 'Arrays & slices', 'examples/arrays.zi', 0),
('enums', 'Enums & branches', 'examples/enums.zi', 0),
('loops', 'Loops & collections', 'examples/loops.zi', 0),
]
+1 -1
View File
@@ -13,7 +13,7 @@
<a href="examples.html"><span>Learn by doing</span><strong>Examples</strong><p><!-- generated:example_count -->16<!-- /generated:example_count --> complete programs with commands, each printing the same output on every target.</p><b>Browse examples →</b></a>
<a href="language.html"><span>Language</span><strong>Syntax reference</strong><p>Modules, declarations, types, generics, control flow, compile-time forms, laws, and foreign calls.</p><b>Read the reference →</b></a>
<a href="api.html#toolchain"><span>Toolchain</span><strong>CLI reference</strong><p>Check, build C or Go, bundle, run, format, and query the toolchain.</p><b>See commands →</b></a>
<a href="modules.html"><span>Libraries</span><strong>Modules and packages</strong><p>Every public declaration in the <!-- generated:std_count -->97<!-- /generated:std_count --> standard modules and the ziranlang packages, generated from the source.</p><b>Browse modules →</b></a>
<a href="modules.html"><span>Libraries</span><strong>Modules and packages</strong><p>Every public declaration in the <!-- generated:std_count -->106<!-- /generated:std_count --> standard modules and the ziranlang packages, generated from the source.</p><b>Browse modules →</b></a>
<a href="status.html"><span>Project</span><strong>Implementation status</strong><p>See what works in the tested subset and what still needs implementation.</p><b>Check support →</b></a>
<a href="guide/packages.html"><span>Projects</span><strong>Packages</strong><p><code>ziran.toml</code> projects, pinned Git dependencies, locks, and installing applications.</p><b>Read the guide →</b></a>
</div></section>
+7
View File
@@ -12,6 +12,13 @@ removed redundant scripts; those fixtures remain in Git history. Run
<h2 id="working-now">Working now</h2>
<ul>
<li>
<p>Native C programs can import portable standard facades for common platform
services. <code>std/thread</code> selects pthreads or native Windows threads while
preserving one <code>Thread</code> API; <code>std/byte_text</code>, <code>std/environment</code>,
<code>std/timer</code>, <code>std/random</code>, <code>std/mapped_file</code>, <code>std/stdio</code>,
<code>std/parallel</code> and <code>std/file_tree</code> similarly hide native-backend modules.</p>
</li>
<li>
<p><code>std/simd</code> vector types and operations run with identical bits in native
C (GCC and Clang vectors with SSE2, SSSE3, SSE4.1, AVX2 and NEON
intrinsics, or the lane loops TinyCC and other compilers use), Go lane
+1 -1
View File
@@ -130,7 +130,7 @@ build/bin/ziran version</code></pre><a class="btn btn-primary" href="get-started
<section class="status-callout modules-callout" aria-labelledby="modules-title">
<div><p class="eyebrow">Libraries</p><h2 id="modules-title">Modules and <em>packages.</em></h2></div>
<div><p><!-- generated:module_counts -->97 standard modules and 16 packages<!-- /generated:module_counts -->, each with an API reference generated from its source, from text and JSON to image codecs.</p><a class="btn" href="modules.html">Browse all modules →</a></div>
<div><p><!-- generated:module_counts -->106 standard modules and 16 packages<!-- /generated:module_counts -->, each with an API reference generated from its source, from text and JSON to image codecs.</p><a class="btn" href="modules.html">Browse all modules →</a></div>
</section>
<section class="status-callout">
<div><p class="eyebrow"><span class="status-dot" aria-hidden="true"></span>Project status</p><h2>Working core.<br><em>Experimental edges.</em></h2></div>
+12 -3
View File
@@ -1,14 +1,15 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="Every Ziran standard module and package: 97 std modules and 16 packages with API references generated from the source."><title>Ziran modules and packages</title><link rel="canonical" href="https://ziran-lang.org/modules"><link rel="icon" href="assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="styles.css"><script defer src="site.js"></script></head>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="Every Ziran standard module and package: 106 std modules and 16 packages with API references generated from the source."><title>Ziran modules and packages</title><link rel="canonical" href="https://ziran-lang.org/modules"><link rel="icon" href="assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="styles.css"><script defer src="site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="index.html"><img class="brand-icon" src="assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="get-started.html">Get started</a><a href="examples.html">Examples</a><a href="targets.html">Targets</a><a href="modules.html" aria-current="page">Modules</a><a href="docs.html">Docs</a><a href="status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow">Reference / Modules</p><h1>Modules and <em>packages.</em></h1><p>97 standard modules and 16 packages, listed from the source on every site build. Each page shows the public declarations <code>ziran api</code> reports, with the comment written above them.</p><p class="module-meta"><span class="status-badge is-stable">Stable</span> ships in the latest release, <a href="https://github.com/ziranlang/ziran/releases/tag/v0.4.2">v0.4.2</a> (for a package: it has a tagged release). <span class="status-badge is-in-progress">In progress</span> exists only on <code>master</code> or has no release yet.</p></div>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow">Reference / Modules</p><h1>Modules and <em>packages.</em></h1><p>106 standard modules and 16 packages, listed from the source on every site build. Each page shows the public declarations <code>ziran api</code> reports, with the comment written above them.</p><p class="module-meta"><span class="status-badge is-stable">Stable</span> ships in the latest release, <a href="https://github.com/ziranlang/ziran/releases/tag/v0.4.2">v0.4.2</a> (for a package: it has a tagged release). <span class="status-badge is-in-progress">In progress</span> exists only on <code>master</code> or has no release yet.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Sections</strong><a href="#std">Standard library</a><a href="#packages">Packages</a></aside><div class="article-body">
<section id="std"><h2>Standard library</h2><p>Import a module with <code>#import "std/NAME"</code>. Modules ending in <code>_linux</code>, <code>_windows</code> or <code>_go</code> build only for that target. A module that needs a host capability runs in a portable bundle only when the program hosting the bundle binds it. 97 of 97 modules shipped in the latest release.</p><div class="table-scroll"><table class="module-table"><thead><tr><th scope="col">Module</th><th scope="col">Summary</th><th scope="col">Needs</th><th scope="col">Status</th></tr></thead><tbody>
<section id="std"><h2>Standard library</h2><p>Import a module with <code>#import "std/NAME"</code>. Modules ending in <code>_linux</code>, <code>_windows</code> or <code>_go</code> build only for that target. A module that needs a host capability runs in a portable bundle only when the program hosting the bundle binds it. 97 of 106 modules shipped in the latest release.</p><div class="table-scroll"><table class="module-table"><thead><tr><th scope="col">Module</th><th scope="col">Summary</th><th scope="col">Needs</th><th scope="col">Status</th></tr></thead><tbody>
<tr><th scope="row"><a href="std/atomic_go.html">atomic_go</a></th><td>Go unsigned 64-bit atomic counters.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/binary.html">binary</a></th><td>Little-endian numbers in byte text, such as file or asset contents, read the same way on every native target and in the portable VM.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/binary_linux.html">binary_linux</a></th><td>Little-endian binary fields for native Linux programs.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/bundle_host.html">bundle_host</a></th><td>Native C ABI for embedding a portable Ziran bundle.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/byte_text.html">byte_text</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-in-progress">In progress</span></td></tr>
<tr><th scope="row"><a href="std/byte_text_linux.html">byte_text_linux</a></th><td>Borrow UTF-8 bytes as a Ziran string at native foreign-function boundaries.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/c_string.html">c_string</a></th><td>Copies a borrowed Ziran string into caller-owned, NUL-terminated storage.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/calendar.html">calendar</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
@@ -20,11 +21,13 @@
<tr><th scope="row"><a href="std/date_time_linux.html">date_time_linux</a></th><td><span class=muted>No module description yet.</span></td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/date_time_types.html">date_time_types</a></th><td>A local or UTC civil clock reading.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/ed25519_go.html">ed25519_go</a></th><td>Ed25519 keys and signatures retain Go's native types and validation behavior.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/environment.html">environment</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-in-progress">In progress</span></td></tr>
<tr><th scope="row"><a href="std/environment_linux.html">environment_linux</a></th><td>The process environment, read through the C library.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/errors_go.html">errors_go</a></th><td>Native Go error creation, identity, wrapping and exact error messages.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/file.html">file</a></th><td>Files on every native C target under one import: Linux, Android, the web, and Windows use file_linux.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/file_go.html">file_go</a></th><td>Native Go file operations preserve filesystem permissions and error identity.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/file_linux.html">file_linux</a></th><td><span class=muted>No module description yet.</span></td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/file_tree.html">file_tree</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-in-progress">In progress</span></td></tr>
<tr><th scope="row"><a href="std/file_tree_linux.html">file_tree_linux</a></th><td>Paths, folders and whole files for native Linux tools and build programs: what a build script needs beyond file_linux's positional I/O.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/float_text.html">float_text</a></th><td>Locale-independent IEEE 754 binary64 decimal conversion, entirely in Ziran.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/format.html">format</a></th><td>Text built on an owned Vec(u8) builder.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
@@ -45,6 +48,7 @@
<tr><th scope="row"><a href="std/json_quote.html">json_quote</a></th><td>JSON string serialization without a document tree.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/json_scan.html">json_scan</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/map_go.html">map_go</a></th><td>Go maps share their storage when copied or passed to a function.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/mapped_file.html">mapped_file</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-in-progress">In progress</span></td></tr>
<tr><th scope="row"><a href="std/mapped_file_linux.html">mapped_file_linux</a></th><td><span class=muted>No module description yet.</span></td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/math.html">math</a></th><td>Portable float32 helpers for native and bundled Ziran programs.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/mutex_linux.html">mutex_linux</a></th><td>A native POSIX mutex.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
@@ -56,6 +60,7 @@
<tr><th scope="row"><a href="std/number_text.html">number_text</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/option.html">option</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/pair.html">pair</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/parallel.html">parallel</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-in-progress">In progress</span></td></tr>
<tr><th scope="row"><a href="std/parallel_linux.html">parallel_linux</a></th><td>Reusable native range workers.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/path.html">path</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/png_linux.html">png_linux</a></th><td>PNG files to and from std/image pictures on native Linux, over the platform zlib (link -lz).</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
@@ -64,6 +69,7 @@
<tr><th scope="row"><a href="std/process_channel_linux.html">process_channel_linux</a></th><td>An owned native child with bidirectional byte I/O.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/process_run_linux.html">process_run_linux</a></th><td>Run native Linux child processes from build and release programs: any number of arguments, a working directory, environment changes, and each standard stream inherited, discarded, read from or written to a file, or captured.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/queue.html">queue</a></th><td>Allocation-free bounded FIFO queue over caller-owned byte storage.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/random.html">random</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-in-progress">In progress</span></td></tr>
<tr><th scope="row"><a href="std/random_go.html">random_go</a></th><td>Cryptographic random bytes from Go, preserving its count and error results.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/random_linux.html">random_linux</a></th><td>Secure operating-system randomness for native Linux programs.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/resample.html">resample</a></th><td>Pillow's separable resampling of 8-bit RGBA as allocation-free row kernels, with std/simd versions for x86-64 (SSE2 to AVX2), NEON (AArch64 and ARMv7) and WebAssembly SIMD128 that make the same bytes.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
@@ -74,6 +80,7 @@
<tr><th scope="row"><a href="std/socket_linux.html">socket_linux</a></th><td>Bounded, cancellation-aware TCP client sockets for native Linux programs.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/sort.html">sort</a></th><td>Sorting and searching for slices of any type ordered by the &lt; operator.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/sql_go.html">sql_go</a></th><td>Native Go SQL handles, nullable strings and transaction cleanup primitives.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/stdio.html">stdio</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-in-progress">In progress</span></td></tr>
<tr><th scope="row"><a href="std/stdio_linux.html">stdio_linux</a></th><td>The standard streams of a native Linux program: text to standard output or standard error, and the whole of standard input.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/string_range.html">string_range</a></th><td>A byte range of an immutable borrowed string.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/sync_go.html">sync_go</a></th><td>Go mutexes.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
@@ -81,9 +88,11 @@
<tr><th scope="row"><a href="std/text_buffer.html">text_buffer</a></th><td>Bounded NUL-terminated byte buffer to borrowed text.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/text_go.html">text_go</a></th><td>Copy between Go-owned byte slices and strings, preserving every byte.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/text_tools.html">text_tools</a></th><td>Searching, splitting and rewriting text for tools and build programs.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/thread.html">thread</a></th><td>One portable native-thread API.</td><td><span class=muted>—</span></td><td><span class="status-badge is-in-progress">In progress</span></td></tr>
<tr><th scope="row"><a href="std/thread_linux.html">thread_linux</a></th><td>Background work for native Linux, Android and macOS programs.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/thread_windows.html">thread_windows</a></th><td>Background work for native 64-bit Windows programs.</td><td>Native Windows</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/time_go.html">time_go</a></th><td>Go wall-clock and monotonic timestamps retain their native time.Time behavior.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/timer.html">timer</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-in-progress">In progress</span></td></tr>
<tr><th scope="row"><a href="std/timer_linux.html">timer_linux</a></th><td><span class=muted>No module description yet.</span></td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/toml_document.html">toml_document</a></th><td>TOML 1.0 documents.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/unicode.html">unicode</a></th><td>Locale-independent Unicode 17.0 text operations.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
+9
View File
@@ -46,6 +46,7 @@
<url><loc>https://ziran-lang.org/std/binary</loc></url>
<url><loc>https://ziran-lang.org/std/binary_linux</loc></url>
<url><loc>https://ziran-lang.org/std/bundle_host</loc></url>
<url><loc>https://ziran-lang.org/std/byte_text</loc></url>
<url><loc>https://ziran-lang.org/std/byte_text_linux</loc></url>
<url><loc>https://ziran-lang.org/std/c_string</loc></url>
<url><loc>https://ziran-lang.org/std/calendar</loc></url>
@@ -57,11 +58,13 @@
<url><loc>https://ziran-lang.org/std/date_time_linux</loc></url>
<url><loc>https://ziran-lang.org/std/date_time_types</loc></url>
<url><loc>https://ziran-lang.org/std/ed25519_go</loc></url>
<url><loc>https://ziran-lang.org/std/environment</loc></url>
<url><loc>https://ziran-lang.org/std/environment_linux</loc></url>
<url><loc>https://ziran-lang.org/std/errors_go</loc></url>
<url><loc>https://ziran-lang.org/std/file</loc></url>
<url><loc>https://ziran-lang.org/std/file_go</loc></url>
<url><loc>https://ziran-lang.org/std/file_linux</loc></url>
<url><loc>https://ziran-lang.org/std/file_tree</loc></url>
<url><loc>https://ziran-lang.org/std/file_tree_linux</loc></url>
<url><loc>https://ziran-lang.org/std/float_text</loc></url>
<url><loc>https://ziran-lang.org/std/format</loc></url>
@@ -82,6 +85,7 @@
<url><loc>https://ziran-lang.org/std/json_quote</loc></url>
<url><loc>https://ziran-lang.org/std/json_scan</loc></url>
<url><loc>https://ziran-lang.org/std/map_go</loc></url>
<url><loc>https://ziran-lang.org/std/mapped_file</loc></url>
<url><loc>https://ziran-lang.org/std/mapped_file_linux</loc></url>
<url><loc>https://ziran-lang.org/std/math</loc></url>
<url><loc>https://ziran-lang.org/std/mutex_linux</loc></url>
@@ -93,6 +97,7 @@
<url><loc>https://ziran-lang.org/std/number_text</loc></url>
<url><loc>https://ziran-lang.org/std/option</loc></url>
<url><loc>https://ziran-lang.org/std/pair</loc></url>
<url><loc>https://ziran-lang.org/std/parallel</loc></url>
<url><loc>https://ziran-lang.org/std/parallel_linux</loc></url>
<url><loc>https://ziran-lang.org/std/path</loc></url>
<url><loc>https://ziran-lang.org/std/png_linux</loc></url>
@@ -101,6 +106,7 @@
<url><loc>https://ziran-lang.org/std/process_channel_linux</loc></url>
<url><loc>https://ziran-lang.org/std/process_run_linux</loc></url>
<url><loc>https://ziran-lang.org/std/queue</loc></url>
<url><loc>https://ziran-lang.org/std/random</loc></url>
<url><loc>https://ziran-lang.org/std/random_go</loc></url>
<url><loc>https://ziran-lang.org/std/random_linux</loc></url>
<url><loc>https://ziran-lang.org/std/resample</loc></url>
@@ -111,6 +117,7 @@
<url><loc>https://ziran-lang.org/std/socket_linux</loc></url>
<url><loc>https://ziran-lang.org/std/sort</loc></url>
<url><loc>https://ziran-lang.org/std/sql_go</loc></url>
<url><loc>https://ziran-lang.org/std/stdio</loc></url>
<url><loc>https://ziran-lang.org/std/stdio_linux</loc></url>
<url><loc>https://ziran-lang.org/std/string_range</loc></url>
<url><loc>https://ziran-lang.org/std/sync_go</loc></url>
@@ -118,9 +125,11 @@
<url><loc>https://ziran-lang.org/std/text_buffer</loc></url>
<url><loc>https://ziran-lang.org/std/text_go</loc></url>
<url><loc>https://ziran-lang.org/std/text_tools</loc></url>
<url><loc>https://ziran-lang.org/std/thread</loc></url>
<url><loc>https://ziran-lang.org/std/thread_linux</loc></url>
<url><loc>https://ziran-lang.org/std/thread_windows</loc></url>
<url><loc>https://ziran-lang.org/std/time_go</loc></url>
<url><loc>https://ziran-lang.org/std/timer</loc></url>
<url><loc>https://ziran-lang.org/std/timer_linux</loc></url>
<url><loc>https://ziran-lang.org/std/toml_document</loc></url>
<url><loc>https://ziran-lang.org/std/unicode</loc></url>
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="API reference for the Ziran std/byte_text module."><title>std/byte_text · Ziran</title><link rel="canonical" href="https://ziran-lang.org/std/byte_text"><link rel="icon" href="../assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="../styles.css"><script defer src="../site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html" aria-current="page">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow"><a href="../modules.html#std">Modules</a> / Standard library</p><h1>std/byte_text</h1><p class="module-meta"><span class="status-badge is-in-progress">In progress</span> Added after release v0.4.2; available when building from source.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Declarations</strong><span>None</span></aside><div class="article-body api-body">
<section><p>Import with <code>#import "std/byte_text"</code>.</p><p>No public declarations.</p><p><a class="text-link" href="https://github.com/ziranlang/ziran/blob/master/std/byte_text.zi">Source ↗</a> · <a class="text-link" href="../modules.html#std">All modules</a></p></section>
</div></div></main>
<footer><div class="footer-top"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><nav aria-label="Footer"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="../index.html#support">Support</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a></nav></div><div class="footer-bottom"><p>A language for useful software.</p><p>© 2026 Kryon Labs · <a href="https://waozi.xyz/">Made by Waozi</a></p></div></footer></body></html>
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="API reference for the Ziran std/environment module."><title>std/environment · Ziran</title><link rel="canonical" href="https://ziran-lang.org/std/environment"><link rel="icon" href="../assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="../styles.css"><script defer src="../site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html" aria-current="page">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow"><a href="../modules.html#std">Modules</a> / Standard library</p><h1>std/environment</h1><p class="module-meta"><span class="status-badge is-in-progress">In progress</span> Added after release v0.4.2; available when building from source.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Declarations</strong><span>None</span></aside><div class="article-body api-body">
<section><p>Import with <code>#import "std/environment"</code>.</p><p>No public declarations.</p><p><a class="text-link" href="https://github.com/ziranlang/ziran/blob/master/std/environment.zi">Source ↗</a> · <a class="text-link" href="../modules.html#std">All modules</a></p></section>
</div></div></main>
<footer><div class="footer-top"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><nav aria-label="Footer"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="../index.html#support">Support</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a></nav></div><div class="footer-bottom"><p>A language for useful software.</p><p>© 2026 Kryon Labs · <a href="https://waozi.xyz/">Made by Waozi</a></p></div></footer></body></html>
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="API reference for the Ziran std/file_tree module."><title>std/file_tree · Ziran</title><link rel="canonical" href="https://ziran-lang.org/std/file_tree"><link rel="icon" href="../assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="../styles.css"><script defer src="../site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html" aria-current="page">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow"><a href="../modules.html#std">Modules</a> / Standard library</p><h1>std/file_tree</h1><p class="module-meta"><span class="status-badge is-in-progress">In progress</span> Added after release v0.4.2; available when building from source.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Declarations</strong><span>None</span></aside><div class="article-body api-body">
<section><p>Import with <code>#import "std/file_tree"</code>.</p><p>No public declarations.</p><p><a class="text-link" href="https://github.com/ziranlang/ziran/blob/master/std/file_tree.zi">Source ↗</a> · <a class="text-link" href="../modules.html#std">All modules</a></p></section>
</div></div></main>
<footer><div class="footer-top"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><nav aria-label="Footer"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="../index.html#support">Support</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a></nav></div><div class="footer-bottom"><p>A language for useful software.</p><p>© 2026 Kryon Labs · <a href="https://waozi.xyz/">Made by Waozi</a></p></div></footer></body></html>
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="API reference for the Ziran std/mapped_file module."><title>std/mapped_file · Ziran</title><link rel="canonical" href="https://ziran-lang.org/std/mapped_file"><link rel="icon" href="../assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="../styles.css"><script defer src="../site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html" aria-current="page">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow"><a href="../modules.html#std">Modules</a> / Standard library</p><h1>std/mapped_file</h1><p class="module-meta"><span class="status-badge is-in-progress">In progress</span> Added after release v0.4.2; available when building from source.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Declarations</strong><span>None</span></aside><div class="article-body api-body">
<section><p>Import with <code>#import "std/mapped_file"</code>.</p><p>No public declarations.</p><p><a class="text-link" href="https://github.com/ziranlang/ziran/blob/master/std/mapped_file.zi">Source ↗</a> · <a class="text-link" href="../modules.html#std">All modules</a></p></section>
</div></div></main>
<footer><div class="footer-top"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><nav aria-label="Footer"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="../index.html#support">Support</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a></nav></div><div class="footer-bottom"><p>A language for useful software.</p><p>© 2026 Kryon Labs · <a href="https://waozi.xyz/">Made by Waozi</a></p></div></footer></body></html>
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="API reference for the Ziran std/parallel module."><title>std/parallel · Ziran</title><link rel="canonical" href="https://ziran-lang.org/std/parallel"><link rel="icon" href="../assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="../styles.css"><script defer src="../site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html" aria-current="page">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow"><a href="../modules.html#std">Modules</a> / Standard library</p><h1>std/parallel</h1><p class="module-meta"><span class="status-badge is-in-progress">In progress</span> Added after release v0.4.2; available when building from source.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Declarations</strong><span>None</span></aside><div class="article-body api-body">
<section><p>Import with <code>#import "std/parallel"</code>.</p><p>No public declarations.</p><p><a class="text-link" href="https://github.com/ziranlang/ziran/blob/master/std/parallel.zi">Source ↗</a> · <a class="text-link" href="../modules.html#std">All modules</a></p></section>
</div></div></main>
<footer><div class="footer-top"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><nav aria-label="Footer"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="../index.html#support">Support</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a></nav></div><div class="footer-bottom"><p>A language for useful software.</p><p>© 2026 Kryon Labs · <a href="https://waozi.xyz/">Made by Waozi</a></p></div></footer></body></html>
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="API reference for the Ziran std/random module."><title>std/random · Ziran</title><link rel="canonical" href="https://ziran-lang.org/std/random"><link rel="icon" href="../assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="../styles.css"><script defer src="../site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html" aria-current="page">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow"><a href="../modules.html#std">Modules</a> / Standard library</p><h1>std/random</h1><p class="module-meta"><span class="status-badge is-in-progress">In progress</span> Added after release v0.4.2; available when building from source.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Declarations</strong><span>None</span></aside><div class="article-body api-body">
<section><p>Import with <code>#import "std/random"</code>.</p><p>No public declarations.</p><p><a class="text-link" href="https://github.com/ziranlang/ziran/blob/master/std/random.zi">Source ↗</a> · <a class="text-link" href="../modules.html#std">All modules</a></p></section>
</div></div></main>
<footer><div class="footer-top"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><nav aria-label="Footer"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="../index.html#support">Support</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a></nav></div><div class="footer-bottom"><p>A language for useful software.</p><p>© 2026 Kryon Labs · <a href="https://waozi.xyz/">Made by Waozi</a></p></div></footer></body></html>
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="API reference for the Ziran std/stdio module."><title>std/stdio · Ziran</title><link rel="canonical" href="https://ziran-lang.org/std/stdio"><link rel="icon" href="../assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="../styles.css"><script defer src="../site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html" aria-current="page">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow"><a href="../modules.html#std">Modules</a> / Standard library</p><h1>std/stdio</h1><p class="module-meta"><span class="status-badge is-in-progress">In progress</span> Added after release v0.4.2; available when building from source.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Declarations</strong><span>None</span></aside><div class="article-body api-body">
<section><p>Import with <code>#import "std/stdio"</code>.</p><p>No public declarations.</p><p><a class="text-link" href="https://github.com/ziranlang/ziran/blob/master/std/stdio.zi">Source ↗</a> · <a class="text-link" href="../modules.html#std">All modules</a></p></section>
</div></div></main>
<footer><div class="footer-top"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><nav aria-label="Footer"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="../index.html#support">Support</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a></nav></div><div class="footer-bottom"><p>A language for useful software.</p><p>© 2026 Kryon Labs · <a href="https://waozi.xyz/">Made by Waozi</a></p></div></footer></body></html>
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="One portable native-thread API."><title>std/thread · Ziran</title><link rel="canonical" href="https://ziran-lang.org/std/thread"><link rel="icon" href="../assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="../styles.css"><script defer src="../site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html" aria-current="page">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow"><a href="../modules.html#std">Modules</a> / Standard library</p><h1>std/thread</h1><p>One portable native-thread API. POSIX targets use pthreads; native Win64</p><p class="module-meta"><span class="status-badge is-in-progress">In progress</span> Added after release v0.4.2; available when building from source.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Declarations</strong><span>None</span></aside><div class="article-body api-body">
<section><p>Import with <code>#import "std/thread"</code>.</p><p>No public declarations.</p><p><a class="text-link" href="https://github.com/ziranlang/ziran/blob/master/std/thread.zi">Source ↗</a> · <a class="text-link" href="../modules.html#std">All modules</a></p></section>
</div></div></main>
<footer><div class="footer-top"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><nav aria-label="Footer"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="../index.html#support">Support</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a></nav></div><div class="footer-bottom"><p>A language for useful software.</p><p>© 2026 Kryon Labs · <a href="https://waozi.xyz/">Made by Waozi</a></p></div></footer></body></html>
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="API reference for the Ziran std/timer module."><title>std/timer · Ziran</title><link rel="canonical" href="https://ziran-lang.org/std/timer"><link rel="icon" href="../assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="../styles.css"><script defer src="../site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html" aria-current="page">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow"><a href="../modules.html#std">Modules</a> / Standard library</p><h1>std/timer</h1><p class="module-meta"><span class="status-badge is-in-progress">In progress</span> Added after release v0.4.2; available when building from source.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Declarations</strong><span>None</span></aside><div class="article-body api-body">
<section><p>Import with <code>#import "std/timer"</code>.</p><p>No public declarations.</p><p><a class="text-link" href="https://github.com/ziranlang/ziran/blob/master/std/timer.zi">Source ↗</a> · <a class="text-link" href="../modules.html#std">All modules</a></p></section>
</div></div></main>
<footer><div class="footer-top"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><nav aria-label="Footer"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="../index.html#support">Support</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a></nav></div><div class="footer-bottom"><p>A language for useful software.</p><p>© 2026 Kryon Labs · <a href="https://waozi.xyz/">Made by Waozi</a></p></div></footer></body></html>
+1
View File
@@ -0,0 +1 @@
using Platform :: #import "byte_text_linux"
+1
View File
@@ -0,0 +1 @@
using Platform :: #import "environment_linux"
+1
View File
@@ -0,0 +1 @@
using Platform :: #import "file_tree_linux"
+1
View File
@@ -0,0 +1 @@
using Platform :: #import "mapped_file_linux"
+1
View File
@@ -0,0 +1 @@
using Platform :: #import "parallel_linux"
+1
View File
@@ -0,0 +1 @@
using Platform :: #import "random_linux"
+1
View File
@@ -0,0 +1 @@
using Platform :: #import "stdio_linux"
+6
View File
@@ -0,0 +1,6 @@
// One portable native-thread API. POSIX targets use pthreads; native Win64
#if #defined(_WIN32) {
using Platform :: #import "thread_windows"
} else {
using Platform :: #import "thread_linux"
}
+1
View File
@@ -0,0 +1 @@
using Platform :: #import "timer_linux"
+11
View File
@@ -23,6 +23,10 @@ AppendScalar :: (output: *Vec(u8), point: u32) {
}
AppendMapping :: (output: *Vec(u8), point: u32, mode: s32) {
if mode == 1 && point >= cast(u32)65 && point <= cast(u32)90 {
AppendScalar(output, point + cast(u32)32)
return
}
record := D.Mapping(point, mode)
if record.count == 0 { AppendScalar(output, point); return }
count := cast(s32)record[3]
@@ -110,6 +114,13 @@ LowerInto :: (text: string, output: *Vec(u8)) -> bool {
if point == 931 && preceded && !FollowedByCased(text,after) {
if !CheckedScalar(output,962) { VecClear(<<output); return false }
} else {
if point >= cast(u32)65 && point <= cast(u32)90 {
if !CheckedScalar(output, point + cast(u32)32) { VecClear(<<output); return false }
flags := D.Property(point)
if (flags & 8) == 0 { preceded = (flags & 4) != 0 }
at = after
continue
}
record := D.Mapping(point,1)
if record.count == 0 {
if !CheckedScalar(output,point) { VecClear(<<output); return false }
+1 -1
View File
@@ -5,7 +5,7 @@ set -eu
# and as C and Go.
ziran=$1
repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
examples=$repo/site/examples
examples=$repo/examples
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT HUP INT TERM
+1 -1
View File
@@ -24,7 +24,7 @@ async function main() {
['functions', null]
];
for (const [name, expected] of examples) {
const result = run(fs.readFileSync(path.join(__dirname, '../site/examples', name + '.zi'), 'utf8'));
const result = run(fs.readFileSync(path.join(__dirname, '../examples', name + '.zi'), 'utf8'));
assert.equal(result.status, 0, name + ': ' + result.diagnostics);
if (expected !== null) assert.equal(result.output, expected, name);
assert.deepEqual(result.stages, ['check', 'build', 'run']);
+1 -1
View File
@@ -30,7 +30,7 @@ main :: (argc: s32, argv: **u8) -> s32 {
if !NativeAssert(*test, CheckField(*document, root, "summary") == "Loader module." && JsonCount(*document, entries) == 1 &&
JsonString(*document, JsonElement(*document, entry, 1)) == "Double :: (n: s32) -> s32" &&
JsonString(*document, JsonElement(*document, entry, 2)) == "Doubles a number.", "loaded declaration documentation came from the wrong file or line") { return 1 }
hello := NativeRead(*test, CheckPath(test.repo, "site/examples/hello.zi"))
hello := NativeRead(*test, CheckPath(test.repo, "examples/hello.zi"))
if !NativeWrite(*test, CheckPath(test.work, "hello.zi"), hello) { return 1 }
run := string.[test.ziran, "run", "hello.zi"]
direct := string.[CheckPath(PathParent(test.ziran), "zi2zx"), "hello.zi"]
+1 -5
View File
@@ -1,8 +1,4 @@
#if #defined(_WIN32) {
#import "thread_windows"
} else {
#import "thread_linux"
}
#import "thread"
#import "timer_linux"
first: Thread;