Modules
May programs are organized into files. Pull in standard modules by name and your own files by path.
Standard modules
These ship with the interpreter and are imported by name without an extension:
import "io";
import "http";
import "html";
import "string";
import "math";
import "api";
import "fs";
import "dotenv";After importing, every builtin in the module becomes available in your script.
Your own files
Local imports use a relative path ending in .may. Mark anything you want callers to see with export.
// math_utils.may
export int square(int n) {
return n * n;
}
export int cube(int n) {
return n * n * n;
}// main.may
import "io";
import "math_utils.may";
square(5) | print;
cube(3) | print;Exporting values
You can export top-level variables in addition to functions:
// config.may
export string secret = "My secret phrase...";// main.may
import "io";
import "config.may";
secret | print;Project layout
A typical web app might look like this:
my-app/
server.may // entrypoint, imports everything
layout.may // shared HTML wrapper
pages/
home.may
about.may
components/
nav.mayThere is no central manifest. Imports drive the dependency graph; the file you pass to may is the entrypoint.