Modules and Projects
RUDRA 1.1.0 organises code as files that import each other with import "name";. There are no project manifests or scaffolding commands in this release.
Writing a module
Any .rux file is a module. Put functions in it and leave out the return main(); line. Save this as shapes.rux:
fn square(n: int) -> int {
return n * n;
}
fn cube(n: int) -> int {
return n * square(n);
} Importing a module
A file next to it can start with import "shapes"; and call cube(3); compiled with ruxc main.rux main, it prints 27. ruxc resolves imports only from the directory of the source file being compiled, so keep the modules beside it.
The std library is imported the same way. Because it is not in your source directory, compile such programs with rudra, which copies the std library next to a temporary copy of the source first:
import "math";
fn main() -> int {
print(to_str(gcd(12, 18)) + "\n");
return 0;
}
return main(); rudra gcd.rux gcd && ./gcd This prints 6.
Run and build
There is no rudra new, rudra run, rudra build, rudra check or Rux.toml in the released toolchain. Compile with ruxc file.rux output (or rudra file.rux output) and run ./output.
Not yet released
The source repository contains a newer driver (driver/rudra.rux) with build, run, check and version commands, and a package tool (package-manager/ruxpkg.rux) that verifies a manifest module's SHA-256. Neither is part of the 1.1.0 release, and no public package directory is published on this site.