Skip to content

Commit e010e77

Browse files
committed
Overhaul docs site: in-page Markdown, mermaid diagrams, dedupe, llms-full
- Render Markdown in-page (marked + DOMPurify) instead of linking to raw .md; add .markdown-body theme reusing existing tokens; rewrite same-base /docs/*.md anchors into react-router navigations. - Add mermaid diagrams (dark, strict, dynamic import): pipeline + verification layers (compiler.md, pipeline.md), language surface mindmap (language.md), release flow (release.md), fetch order (guide/agent-usage.md), doc tree (index.md), and Implemented/Gaps/Planned buckets (status.md). - Deduplicate near-duplicate docs into canonical /guide/* and /dev/* pages with short alias stubs: installation, cli, api, features, agent-usage, plugins, contributing. Update navigation.ts to point at canonical paths. - Content fixes: drop empty bash fence in getting-started.md; sync example count to 43 (README.md, Status.tsx, examples.ts, test_examples_e2e.py, examples.md, changelog.md, Home.tsx, release.md); add Errors and Exit Codes table to guide/cli.md. - Expand site/public/llms-full.txt into a true single-file context: full 43-example catalog, errors/exit-codes table, ASCII pipeline + architecture diagrams, agent fetch order, plugin pointers, docs cross-refs. - Add 5 application-style examples (038-042) with golden outputs; bump Examples verified to 43/43. - Remove stale duplicate AGENT.md (canonical is AGENTS.md).
1 parent 86819f5 commit e010e77

41 files changed

Lines changed: 2105 additions & 438 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENT.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Changed
11+
- Docs site now renders Markdown in-page with mermaid diagrams (pipeline,
12+
verification layers, release flow, doc tree, fetch order, language surface);
13+
deduped near-duplicate docs into `/guide` and `/dev` canonical pages with
14+
short aliases; expanded `site/public/llms-full.txt` into a true single-file
15+
context with the full 43-example catalog, errors/exit-codes table, ASCII
16+
pipeline and architecture diagrams, agent fetch order, and plugin pointers.
1117
- Semantic analysis now has an internal safety-proof phase after base type
1218
checking and semantic validation. Risky casts, division/modulo, indexing,
1319
slicing, and reference dereferences must be approved through a `BackendPlan`
@@ -19,6 +25,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1925
non-zero, bounds, and non-nil facts live in the safety analysis layer.
2026
- Examples using heap `new` now check against `nil` before field access, and the
2127
function example guards division by zero.
28+
- Added five runnable application-style examples covering inventory reporting,
29+
text analysis, task-board risk scoring, route simulation, and gradebook
30+
averages.
2231
- C backend support has been retired from the public compiler. Zig is now the
2332
only supported code generation target, and CI/release/example verification
2433
gates focus on Zig output.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Use fixed-width integers such as `i32`, `i64`, `u32`, or `u64` when the data its
188188
- `SECURITY.md` - Security policy and trust boundary
189189
- `RELEASE_READINESS_REVIEW.md` - Current release-readiness audit
190190
- `COMPLETION_AUDIT.md` - Strict objective-to-evidence release audit
191-
- `examples/` - 38 sample programs
191+
- `examples/` - 43 sample programs
192192
- `MISSING_FEATURES.md` - Feature status and roadmap
193193
- `CHANGELOG.md` - Change history
194194
- `docs/ERROR_ANALYSIS.md` - Historical error-analysis snapshot, not current status

examples/038_inventory_report.a7

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Inventory report with structs, refs, and guarded arithmetic
2+
3+
io :: import "std/io"
4+
5+
Item :: struct {
6+
name: string
7+
stock: i32
8+
reorder: i32
9+
price: i32
10+
}
11+
12+
value_of :: fn(item: Item) i32 {
13+
ret item.stock * item.price
14+
}
15+
16+
apply_discount :: fn(item: ref Item, percent: i32) {
17+
if percent <= 0 {
18+
ret
19+
}
20+
if percent >= 100 {
21+
item.price = 0
22+
ret
23+
}
24+
25+
remaining := 100 - percent
26+
item.price = (item.price * remaining) / 100
27+
}
28+
29+
print_item :: fn(index: i32, item: Item) i32 {
30+
line_value := value_of(item)
31+
if item.stock <= item.reorder {
32+
io.println("{}: {} stock={} value={} reorder=yes", index, item.name, item.stock, line_value)
33+
ret 1
34+
}
35+
36+
io.println("{}: {} stock={} value={} reorder=no", index, item.name, item.stock, line_value)
37+
ret 0
38+
}
39+
40+
main :: fn() {
41+
io.println("=== Inventory Report ===")
42+
43+
wrench := Item{name: "wrench", stock: 12, reorder: 5, price: 15}
44+
bolt := Item{name: "bolt", stock: 48, reorder: 50, price: 1}
45+
sensor := Item{name: "sensor", stock: 7, reorder: 8, price: 42}
46+
panel := Item{name: "panel", stock: 3, reorder: 2, price: 75}
47+
48+
apply_discount(sensor, 10)
49+
50+
total := value_of(wrench) + value_of(bolt) + value_of(sensor) + value_of(panel)
51+
reorder_count := 0
52+
53+
reorder_count += print_item(0, wrench)
54+
reorder_count += print_item(1, bolt)
55+
reorder_count += print_item(2, sensor)
56+
reorder_count += print_item(3, panel)
57+
58+
io.println("total value = {}", total)
59+
io.println("items to reorder = {}", reorder_count)
60+
}

examples/039_text_analyzer.a7

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Text analyzer using strings, chars, slices, and loops
2+
3+
io :: import "std/io"
4+
5+
is_vowel :: fn(ch: char) bool {
6+
ret ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u' or ch == 'A' or ch == 'E' or ch == 'I' or ch == 'O' or ch == 'U'
7+
}
8+
9+
count_vowels :: fn(text: string) usize {
10+
count: usize = 0
11+
for ch in text {
12+
if is_vowel(ch) {
13+
count += 1
14+
}
15+
}
16+
ret count
17+
}
18+
19+
count_char :: fn(text: string, needle: char) usize {
20+
count: usize = 0
21+
for ch in text {
22+
if ch == needle {
23+
count += 1
24+
}
25+
}
26+
ret count
27+
}
28+
29+
main :: fn() {
30+
io.println("=== Text Analyzer ===")
31+
32+
text: string = "A7 systems language"
33+
prefix := text[0..2]
34+
word := text[3..10]
35+
36+
io.println("text = {}", text)
37+
io.println("vowels = {}", count_vowels(text))
38+
io.println("spaces = {}", count_char(text, ' '))
39+
io.println("letter a = {}", count_char(text, 'a'))
40+
41+
io.print("prefix = ")
42+
for ch in prefix {
43+
io.print("{}", ch)
44+
}
45+
io.println("")
46+
47+
io.print("word = ")
48+
for ch in word {
49+
io.print("{}", ch)
50+
}
51+
io.println("")
52+
}

examples/040_task_board.a7

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Task board with ref mutation and priority labels
2+
3+
io :: import "std/io"
4+
5+
Task :: struct {
6+
title: string
7+
priority: i32
8+
estimate: i32
9+
done: bool
10+
}
11+
12+
complete :: fn(task: ref Task) {
13+
task.done = true
14+
}
15+
16+
raise_priority :: fn(task: ref Task) {
17+
if task.priority < 5 {
18+
task.priority += 1
19+
}
20+
}
21+
22+
risk_score :: fn(task: Task) i32 {
23+
if task.done {
24+
ret 0
25+
}
26+
ret task.priority * task.estimate
27+
}
28+
29+
priority_label :: fn(priority: i32) string {
30+
match priority {
31+
case 1: { ret "low" }
32+
case 2, 3: { ret "normal" }
33+
case 4: { ret "high" }
34+
else: { ret "critical" }
35+
}
36+
}
37+
38+
print_task :: fn(index: i32, task: Task) i32 {
39+
score := risk_score(task)
40+
io.println("{}: {} priority={} done={} risk={}", index, task.title, priority_label(task.priority), task.done, score)
41+
if task.done {
42+
ret 0
43+
}
44+
ret 1
45+
}
46+
47+
main :: fn() {
48+
io.println("=== Task Board ===")
49+
50+
parser := Task{title: "parser cleanup", priority: 3, estimate: 4, done: false}
51+
docs := Task{title: "docs pass", priority: 2, estimate: 3, done: false}
52+
audit := Task{title: "release audit", priority: 4, estimate: 5, done: false}
53+
examples := Task{title: "examples", priority: 1, estimate: 2, done: false}
54+
55+
complete(docs)
56+
raise_priority(audit)
57+
raise_priority(examples)
58+
59+
open_tasks := 0
60+
total_risk := 0
61+
62+
open_tasks += print_task(0, parser)
63+
total_risk += risk_score(parser)
64+
open_tasks += print_task(1, docs)
65+
total_risk += risk_score(docs)
66+
open_tasks += print_task(2, audit)
67+
total_risk += risk_score(audit)
68+
open_tasks += print_task(3, examples)
69+
total_risk += risk_score(examples)
70+
71+
io.println("open tasks = {}", open_tasks)
72+
io.println("total risk = {}", total_risk)
73+
}

examples/041_route_simulation.a7

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Route simulation with structs, arrays, and iterative movement
2+
3+
io :: import "std/io"
4+
5+
Point :: struct {
6+
x: i32
7+
y: i32
8+
}
9+
10+
abs_i32 :: fn(value: i32) i32 {
11+
if value < 0 {
12+
ret -value
13+
}
14+
ret value
15+
}
16+
17+
move_by :: fn(point: ref Point, dx: i32, dy: i32) {
18+
point.x += dx
19+
point.y += dy
20+
}
21+
22+
manhattan :: fn(point: Point) i32 {
23+
ret abs_i32(point.x) + abs_i32(point.y)
24+
}
25+
26+
main :: fn() {
27+
io.println("=== Route Simulation ===")
28+
29+
position := Point{x: 0, y: 0}
30+
dx: [6]i32 = [2, 1, -1, 0, 3, -2]
31+
dy: [6]i32 = [0, 2, 1, -3, 1, 0]
32+
33+
total_distance := 0
34+
35+
for i := cast(usize, 0); i < 6; i += 1 {
36+
step_distance := abs_i32(dx[i]) + abs_i32(dy[i])
37+
total_distance += step_distance
38+
move_by(position, dx[i], dy[i])
39+
io.println("step {} -> ({}, {}) distance={}", i, position.x, position.y, step_distance)
40+
}
41+
42+
io.println("final manhattan = {}", manhattan(position))
43+
io.println("path distance = {}", total_distance)
44+
}

examples/042_gradebook.a7

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Gradebook with nested arrays in structs and ref-based curve updates
2+
3+
io :: import "std/io"
4+
5+
Student :: struct {
6+
name: string
7+
scores: [3]i32
8+
}
9+
10+
average :: fn(student: Student) i32 {
11+
total := student.scores[0] + student.scores[1] + student.scores[2]
12+
ret total / 3
13+
}
14+
15+
letter :: fn(avg: i32) string {
16+
match avg {
17+
case 90..100: { ret "A" }
18+
case 80..89: { ret "B" }
19+
case 70..79: { ret "C" }
20+
case 60..69: { ret "D" }
21+
else: { ret "F" }
22+
}
23+
}
24+
25+
add_curve :: fn(student: ref Student, points: i32) {
26+
for i := cast(usize, 0); i < 3; i += 1 {
27+
next := student.scores[i] + points
28+
if next > 100 {
29+
student.scores[i] = 100
30+
} else {
31+
student.scores[i] = next
32+
}
33+
}
34+
}
35+
36+
print_student :: fn(index: i32, student: Student) i32 {
37+
avg := average(student)
38+
io.println("{}: {} avg={} grade={}", index, student.name, avg, letter(avg))
39+
ret avg
40+
}
41+
42+
main :: fn() {
43+
io.println("=== Gradebook ===")
44+
45+
mira := Student{name: "Mira", scores: [88, 91, 84]}
46+
noah := Student{name: "Noah", scores: [73, 78, 81]}
47+
lina := Student{name: "Lina", scores: [95, 97, 99]}
48+
49+
add_curve(noah, 5)
50+
51+
class_total := 0
52+
class_total += print_student(0, mira)
53+
class_total += print_student(1, noah)
54+
class_total += print_student(2, lina)
55+
56+
class_avg := class_total / 3
57+
io.println("class average = {}", class_avg)
58+
}

0 commit comments

Comments
 (0)