Project Anatomy & wysna.toml
For applications larger than a single script, Wysna utilizes a structured project directory governed by a manifest file named wysna.toml.
Initializing a New Project
Section titled “Initializing a New Project”To create a new Wysna package, use wysna init:
wysna init my_projectcd my_projectThis generates the standard layout:
my_project/├── wysna.toml # Project manifest & compiler configuration└── src/ └── main.wysna # Application entry pointThe wysna.toml Manifest
Section titled “The wysna.toml Manifest”The manifest defines package metadata, compilation targets, and dependency links:
[package]name = "my_project"version = "0.1.0"authors = ["Washington Yandún <washo@wysofia.com>"]entry = "src/main.wysna"
[build]target = "host-native" # Options: host-native, c99, wasiopt_level = 2 # Optimization level passed to C backend (0, 1, 2, 3)debug = true # Preserve source maps and line assertions
[dependencies]# External Wysna modules or native C librariesMulti-File Organization & Imports
Section titled “Multi-File Organization & Imports”You can organize code across multiple files inside src/. For example, create src/math_utils.wysna:
## src/math_utils.wysna
pub fn square(x: int) -> int { return x * x}
pub fn clamp(val: int, min_val: int, max_val: int) -> int { if val < min_val { return min_val } if val > max_val { return max_val } return val}Now import and use it in src/main.wysna using string path imports:
## src/main.wysnaimport "math_utils.wysna"
fn main() -> unit { let result = math_utils.square(8) print("Square of 8:", result)
let clamped = math_utils.clamp(120, 0, 100) print("Clamped value:", clamped)}Compile the entire project from the root directory:
wysna buildThe output binary will be written to build/bin/my_project.