Hello, Faber
Write the smallest useful Faber program: a package entry point that formats a string and prints it.
Prerequisites#
Complete Install and download first. You should have a
faber binary on your PATH and a shell in a working directory where you can
create files.
Create a package#
mkdir salve-munde
cd salve-munde
mkdir src
cat > faber.toml <<'EOF'
[package]
name = "salve-munde"
version = "0.1.0"
EOFThen write src/main.fab:
fn salve(string nomen) → string {
const string msg ← "Salve, §!"(nomen)
return msg
}
main {
const string m ← salve("munde")
print m
}Check it#
faber check .faber check runs the front end: lexing, parsing, type checking, and lowering
far enough to catch ordinary package mistakes without building a native binary.
If the command fails, read the diagnostic code first; Faber diagnostics are
intended to be stable search handles.
Run it#
faber run .Expected output:
Salve, munde!What you just used#
| Source | Meaning |
|---|---|
functio salve(textus nomen) → textus | Function named salve, type-first parameter, text return |
fixum textus msg ← ... | Immutable binding |
"Salve, §!"(nomen) | Format string with display interpolation |
redde msg | Return |
main | Package entry point |
nota m | Print a note/output value |
Locale proof#
The program above is the canonical Latin reader rendering. Reader locales can render the same semantic program with different keyword packs while preserving glyphs and identifiers. Start with the full proof at Reader locale before writing non-Latin packages.
Next#
| Previous | Next |
|---|---|
| Install and download | Commands you will use |