Skip to content

axon-examples

Showcase programs demonstrating the Axon programming language. Currently 28 examples across 6 categories.

Algorithms & Data Structures (12 examples)

Section titled “Algorithms & Data Structures (12 examples)”
ExampleDescriptionStatus
fibonacci.axsRecursive and iterative FibonacciCI
collatz.axsCollatz conjecture sequenceCI
fizzbuzz.axsClassic FizzBuzzCI
gcd.axsGreatest common divisor (Euclidean)CI
sieve.axsSieve of EratosthenesCI
binary_search.axsBinary search on sorted arraysCI
bubble_sort.axsBubble sort implementationCI
linked_list.axsPointer-based linked listSKIP (requires std lib)
stack_machine.axsStack-based expression evaluatorCI
matrix.axsMatrix operations (multiply, transpose)CI
graph_bfs.axsBFS + Kahn’s topological sort over a directed graphCI
async_pipeline.axsasync fn and await — batch processing pipelineSKIP (requires std lib)
ExampleDescriptionStatus
wc.axsUnix wc clone — word/line/byte counterCI
cat.axsUnix cat clone — file concatenationCI
uniq.axsUnix uniq clone — adjacent duplicate counterCI
line_count.axsLine counting utilityCI
rot13.axsROT13 cipher encoder/decoderCI
ExampleDescriptionStatus
option_types.axsOption<T> — Some, None, pattern matchingCI
math_demo.axsNumeric types and arithmeticSKIP (requires std lib)

Networking (10 examples — requires std library)

Section titled “Networking (10 examples — requires std library)”
ExampleDescriptionStatus
echo_server.axsTCP echo serverSKIP (requires std lib)
http_server.axsHTTP/1.1 web serverSKIP (requires std lib)
routing_server.axsHTTP server with URL routingSKIP (requires std lib)
rest_api.axsREST API with JSON responsesSKIP (requires std lib)
rest_api/server.axsREST API server (multi-module)SKIP (requires std lib)
rest_api/models.axsData models + JSON serializationSKIP (requires std lib)
rest_api/handlers.axsRoute handlers + HTTP responsesSKIP (requires std lib)
chat/server.axsWebSocket chat serverSKIP (requires std lib)
chat/client.axsCLI chat clientSKIP (requires std lib)
chat/protocol.axsShared chat protocol (JSON)SKIP (requires std lib)
ExampleDescriptionStatus
gui_calculator.axsCalculator applicationSKIP (requires raylib)
ExampleDescriptionStatus
lsp_demo/LSP editor integration — VS Code + Neovim config + smoke testCI

Status key:

  • CI — built, tested, and metrics-collected in CI
  • SKIP (requires std lib) — skipped in CI (depends on axon-std modules not available in CI)
  • SKIP (requires raylib) — skipped in CI (depends on libraylib not installed in CI runners)
Terminal window
# Compile and run an example
axonc examples/fibonacci.axs -o fibonacci
./fibonacci
# Or use the QBE backend explicitly
axonc --emit-qbe examples/fibonacci.axs -o fibonacci.ssa
qbe -o fibonacci.s fibonacci.ssa
cc -o fibonacci fibonacci.s -laxon_rt
./fibonacci

This repo uses a shared CI template from axon-ci. See docs/ci-pipeline.md for full pipeline documentation.

As of axon-ci#18, this repo uses the perf-thresholds template to detect performance regressions:

  • Binary size: ≥ 20% increase fails (lenient — examples are tiny)
  • Compile time: ≥ 30% increase fails (lenient — shared CI runners have high variance)
  • MR comment: Auto-posted on every pipeline run showing baseline vs current
  • Baseline: Fetched from main via GitLab API (falls back to git if token missing)

The performance:regression-check job is allow_failure: true during initial rollout. After a stable baseline is established, tighten thresholds by overriding the job:

performance:regression-check:
allow_failure: false

See templates/perf-thresholds.yml in axon-ci for full configuration options.

See CONTRIBUTING.md for a complete guide to adding a new example.

MIT