Home/Examples/lib/examples/sleela

lib/examples/sleela

37 file(s) under lib/examples/sleela

CLASSIC-hello-world.sleela

sleela CLASSIC-hello-world.sleela

CLI-01-global-memory-options.md

markdown CLI-01-global-memory-options.md

CLI-02-source-and-artifact.md

markdown CLI-02-source-and-artifact.md

CLI-03-multi-source-compilation.md

markdown CLI-03-multi-source-compilation.md

CLI-04-native-and-exec.md

markdown CLI-04-native-and-exec.md

CLI-05-sleeladoc-topic-lookup.md

markdown CLI-05-sleeladoc-topic-lookup.md

CLI-06-sleeladoc-generate-live.md

markdown CLI-06-sleeladoc-generate-live.md

CLI-07-sleeladoc-facade.md

markdown CLI-07-sleeladoc-facade.md

CLI-08-vm-commands.md

markdown CLI-08-vm-commands.md

CLI-09-modium-commands.md

markdown CLI-09-modium-commands.md

CLI-10-registry-commands.md

markdown CLI-10-registry-commands.md

CLI-11-xclass-and-langin.md

markdown CLI-11-xclass-and-langin.md

CLI-12-nordshrift-options.md

markdown CLI-12-nordshrift-options.md

CLI-13-http-server-options.md

markdown CLI-13-http-server-options.md

CLI-14-design-activity.md

markdown CLI-14-design-activity.md

CLI-15-defender-safety.md

markdown CLI-15-defender-safety.md

CLI-16-environment-and-exit-status.md

markdown CLI-16-environment-and-exit-status.md

COMMANDS-and-workflow.md

markdown COMMANDS-and-workflow.md

LEARNER-PATH.md

markdown LEARNER-PATH.md

NEW-bestof-route.sleela

sleela NEW-bestof-route.sleela

NEW-dynamic-arrays.sleela

sleela NEW-dynamic-arrays.sleela

NEW-file-pipes.sleela

sleela NEW-file-pipes.sleela

NEW-munction-file-reach.sleela

sleela NEW-munction-file-reach.sleela

NEW-native-financial-import.sleela

sleela NEW-native-financial-import.sleela

NEW-nested-classes.sleela

sleela NEW-nested-classes.sleela

NEW-signed-wide-integers-2.7.sleela

sleela NEW-signed-wide-integers-2.7.sleela

NEW-static-protected-access.sleela

sleela NEW-static-protected-access.sleela

NEW-struct-network-transport.sleela

sleela NEW-struct-network-transport.sleela

NEW-struct-record.sleela

sleela NEW-struct-record.sleela

NEW-synchro-measure.sleela

sleela NEW-synchro-measure.sleela

NEW-time-api.sleela

sleela NEW-time-api.sleela

NEW-unsigned-wide-integers-2.8.sleela

sleela NEW-unsigned-wide-integers-2.8.sleela

ORIGINAL-fizz-buzz.sleela

sleela ORIGINAL-fizz-buzz.sleela

README.md

markdown README.md

USED-methods-and-return-values.sleela

sleela USED-methods-and-return-values.sleela

USED-short-circuit-guards.sleela

sleela USED-short-circuit-guards.sleela

USED-switch-selection.sleela

sleela USED-switch-selection.sleela

About this collection

SLeeLa language examples

This is the guided language-learning sequence. The foundational examples use syntax 1.7; the advanced examples use documented syntax 2.1 and the newest integer examples demonstrate syntax 2.7 and 2.8.

Start here

  1. CLASSIC Hello World — class, entry point, and print.
  2. ORIGINAL FizzBuzz — variables, loops, remainder, and decisions.
  3. USED methods — parameters, return values, and reuse.
  4. USED switch selection — multi-way branching.
  5. USED short-circuit guards — safe boolean expressions.
  6. NEW dynamic arrays — indexed data and append.
  7. NEW struct records — data aggregates.
  8. NEW nested classes — grouping related types.
  9. NEW native imports — calling library modules.

Advanced feature examples

FileFeature
NEW-file-pipesPipe creation, worker thread, read/write, close, join
NEW-SynchroPacket dispatch and honest latency/loss measurements
NEW-MunctionComposed local file-channel reach and receipt
NEW-Best-ofWeighted route selection using measured outcomes
NEW-struct-network-transportPack/unpack structs across loopback TCP
NEW-time-apiUTC, monotonic time, precision, HTTP date, JSON time
NEW-static-protected-accessStatic protected members and controlled access

Newest syntax examples

For the child-friendly lesson order, vocabulary, and exercises, see LEARNER-PATH.

Commands

See COMMANDS-and-workflow for the command overview. The option-by-option cookbook is indexed below; it follows man/man1/sleela.1 and the C++ command dispatcher.

Command-line examples

ExampleCoverage
CLI-01Global memory-manager flags and size suffixes
CLI-02Version, check, run, compile, artifact validation
CLI-03Multiple source inputs
CLI-04Native/exec, config, memory option, option terminator
CLI-05SleelaDoc topic/package/class lookup
CLI-06Documentation generation and live parsing
CLI-07Facade search and resource caps
CLI-08VM list/select/info/run
CLI-09Modium scan/status/restore
CLI-10Registry read/write/export
CLI-11XClass and JVM-family source modes
CLI-12Nordshrift emit/roundtrip/targets
CLI-13HTTP versions and server flags
CLI-14Seven design-activity axes
CLI-15Defender safety gates
CLI-16Environment variables and exit status

These are documentation examples. Confirm each operation against the exact binary built on the target platform; server, VM, registry, and Defender actions may depend on configuration or have side effects.

Run

From the repository root, after building the runtime:

make -C impl
./impl/build/sleela check lib/examples/sleela/CLASSIC-hello-world.sleela
./impl/build/sleela run lib/examples/sleela/CLASSIC-hello-world.sleela

The authoritative supported syntax range is reported by sleela version and defined in impl/frontend/version.h. The repository's impl/README.md contains an older syntax-range note; prefer the compiler's version output and version.h.

Some examples in other subsystem folders are contract, policy, or simulation demonstrations. Their comments and the catalogue explain when they do not access hardware, external services, or an implemented native bridge.