Karkain by Example
Real, runnable .kark programs that exercise the implemented language,
standard library and toolchain. Every snippet on these pages is taken from a
source file that exists in the repository and has been validated through the
real CLI (karkain check / karkain run / karkain test); the
Runnable categories are pinned byte-identical on both engines by
pkg/cli/phase114_examples_test.go.
Everything here follows the site’s status vocabulary
(Status): a category is only presented as working when it is,
and planned capability is labeled Planned or Not Yet Implemented
explicitly.
The 15-category framework
The Phase 114/116/123 corpus populates the framework with 59 .kark source
files (15 categories, 1 of them deliberately Planned — README only). See the
inventory examples/EXAMPLES.md for the authoritative file list.
Category |
Status |
Examples |
|---|---|---|
Implemented |
|
|
Implemented |
|
|
Implemented (specific examples) |
|
|
Implemented |
|
|
Implemented |
|
|
Implemented |
|
|
Implemented |
|
|
Experimental |
|
|
Implemented (arithmetic demos) |
|
|
Implemented (arithmetic demos) |
|
|
Not Yet Implemented (infrastructure only) |
— |
|
Implemented |
|
|
Implemented (synthetic data) |
|
|
Implemented |
|
|
Implemented |
|
Note
AI and Machine Learning are marked Implemented strictly in the sense of
hand-rolled arithmetic demonstrations — there is no std.ai or ML
framework surface. Quantum is infrastructure-only: parser wiring is
explicitly part of its roadmap. See the individual pages for the exact,
honest claim.
Examples by Category
How to explore
The fastest path is the First Program, then run the corpus:
$ karkain run examples/01-fundamentals/01_hello_world.kark
$ powershell -ExecutionPolicy Bypass -File scripts\verify-examples.ps1
scripts/verify-examples.ps1 classifies every example by its declared
status (Runnable / Experimental / Planned) and runs the runnable
ones through the real CLI — the runnable count grows with each phase gate
(e.g. Phase 130 added the closures fixtures), while the test-mode runner
and the one Planned category are deliberately skipped.
Validation corpus
Three checked-in corpora give these examples their weight:
Conformance —
conformance/contains 11 test files (001_arithmetic_test.kark…011_namespace_test.kark) with 59func test_*functions run through the real front end + C runtime on both engines.Golden outputs — the conformance and probes corpora assert byte-identical stdout on the Go front end and the self-hosted
kccengine (e.g.pkg/cli/phase95_parity_test.go).Phase 114 corpus gate —
pkg/cli/phase114_examples_test.gopins every Runnable example to a golden output on both engines.
Example inventory (repository)
examples/algorithms/— 21 algorithm programs (factorial, fibonacci, gcd, lcm, power, sieve, and more).examples/language_foundation/— 13 golden targets that round-trip the language surface on both engines.examples/concurrency/—pipeline/, the Phase 107 concurrency runtime demo (spawn/join, channels, actors).examples/wasm/— thewasm32-wasitarget corpus (Phases 108/123):hello.karkplusfunctions,control_flow,dataandstrings_builtin. Go-engine production candidate, gated bypkg/cli/phase123_cli_test.go.examples/stdlib_v2/— multi-module end-to-end program importingstd.string,std.collections,std.encodingandstd.crypto(Phase 109).examples/testing/—std.testingmodule validation throughkarkain test(Phase 112).examples/profiling/—basic,recursionandhotspottargets forkarkain prof(Phase 110).
See also
Project Layout — where these directories live. Status — the status vocabulary used throughout this site.