Your First Application
On this page
This walkthrough uses the MatchBox CLI and a single BoxLang script. If MatchBox is not installed yet, start with Installation.
Write a script
Create hello.bxs:
function greet(name) {
return "Hello, #name#!";
}
println(greet("world"));
Run it
matchbox hello.bxs
Expected output:
Hello, world!
MatchBox parses, compiles, and executes the file. The .bxs extension is used for BoxLang scripts.
Build a standalone native executable
matchbox --target native hello.bxs
./hello
Native binary produced: hello
Hello, world!
On Windows, run hello.exe. The output is specific to its operating system and architecture. The executable includes the MatchBox runner, so the destination does not need Java or a separate MatchBox install. See native builds. Native Fusion or host integrations may introduce their own platform requirements.
Compile portable bytecode
matchbox --build hello.bxs
matchbox hello.bxb
Compiled to hello.bxb
Hello, world!
A .bxb file contains compiled bytecode, not a standalone runtime. Its destination still needs a compatible MatchBox runner. Keep compiler and runtime versions aligned.
To omit embedded source text:
matchbox --build --strip-source hello.bxs
Errors retain file and line information, but removing source reduces diagnostic context. It is not encryption or intellectual-property protection.
Explore interactively
Start the REPL by running matchbox without a filename. It reads one line at a time and prints the value of an expression after =>. Type exit or quit, or press Ctrl+D, to leave.
bx> x = 1 + 2
=> 3
bx> println(x)
3
Continue with language essentials, browse the CLI reference, or choose a deployment target.