
Gloat compiles Clojure or
YAMLScript to Go code or native
binaries
Cross-compiles to 20+ platforms including Wasm.
Synopsis
Before using the Try Gloat - Live Demo badge above, read the
Gloat Live Demo section below.
# Compile to native binary (default)
gloat app.clj # Creates ./app binary
gloat app.clj -o myapp # Creates ./myapp binary
# Output intermediate formats
gloat app.ys -t clj # Clojure to stdout
gloat app.ys -t glj # Glojure to stdout
gloat app.ys -t go # Go to stdout
# Create files with -t .ext shorthand
gloat app.ys -t .clj # Creates app.clj
gloat app.ys -t .glj # Creates app.glj
gloat app.ys -t .go # Creates app.go
# Create a portable Go project directory
gloat app.ys -o build/ # Creates build/ directory
# Cross-compile
gloat app.ys -o app-linux --platform=linux/amd64
gloat app.ys -o app.exe --platform=windows/amd64
# Compile and run
gloat --run app.ys # Compile and run (no binary kept)
gloat --run app.ys -- <args...> # Pass arguments to program
# WebAssembly targets
gloat app.ys -o app.wasm # WASI target
gloat app.ys -o app.wasm -t js # JavaScript target
Description
Gloat compiles Clojure or YAMLScript source files to any of these forms:
- Native binaries
- Cross compile to many OS/Arch environments
- Web Assembly
- Shared libraries (
.so, .dylib, .dll)
- With
.h header files for FFI binding
- Go source files
- Standalone Go build directories
.ys → ys -c → .clj
↓
.clj ────────→ rewrite → .glj
↓
.glj ──────────────────→ glj compile → .go
↓
go build → binary/wasm
The tool has zero external dependencies.
All required tools (bb, glj, go, ys) are installed the first time you run
gloat via the Makes build system.
All of these tools will be installed local to the gloat repository under
/path/to/gloat/.cache/.local/ and you will be prompted about it first.
Gloat Live Demo
The gloat repository comes with a lot of example programs.
You can find them in the example/clojure/, and example/yamlscript/
directories.
A great way to view the demos is to start the Gloat Demo Webpage Server with:
$ make serve-example
...some output...
Starting server on http://localhost:8080
Press Ctrl+C to stop
That serves a webpage that will let you try all of the examples interactively.
In the webpage you can choose an example and then click Compile, which
sends it back to the local server, turns it into a Wasm file that can run in
the browser.
It will also show you the Glojure and the Go code that was generated to create
the Wasm.
After a program compiles, you can run it with the Run button.
Run the Demo Now!
At the top of this file, you may have noticed this badge:

GitHub users can click that and see the demo without cloning this repository.
It opens in a GitHub Codespaces session, which starts as an empty VScode editor
session.
If you wait a couple minutes (literally) the demo will start in an editor
pane.
Notes:
The demo page literally takes 1-2 minutes to start.
Use Cmd/Ctrl + Shift + P -> View Creation Log to see full logs.
After the demo starts in the editor, you can pop it out to a separate browser
pane.
Using gloat --run to run examples
Try these:
gloat --run example/yamlscript/dragon-curve.ys
gloat -r example/clojure/even-or-odd.clj -- 7 42 31337
To pass options to a program run with gloat --run, put the after a -- arg.
Installation
Clone this repository and source the .rc file:
$ git clone https://github.com/gloathub/gloat
$ source gloat/.rc
$ gloat --help
==> Installing gloat dependencies (bb, glj, go, ys) locally into:
/home/ingy/src/gloat/worktree/clojure-rewrite/.cache/.local/
Press Enter to continue (or Ctrl-C to cancel)...
The first time you run the gloat command, all its dependencies will be
installed under the /pat/to/gloat/.cache/.local/ directory.
To make gloat a permanent install, add this to your shell's rc file:
source /absolute/path/to/gloat/.rc
| Format |
Flag |
Description |
bin |
-t bin or no extension |
Native executable (default) |
clj |
-t clj |
Clojure source |
bb |
-t bb |
Babashka self-contained script |
glj |
-t glj |
Glojure source |
go |
-t go |
Go source |
dir |
-o path/ |
Portable Go project directory |
lib |
.so or .dylib extension |
Shared library |
wasm |
.wasm extension |
WebAssembly (WASI) |
js |
-t js with .wasm |
WebAssembly (JavaScript) |
The output format is inferred from the -o extension, or can be explicitly
set with -t.
Directory Output
When outputting to a directory (-o build/), gloat generates a self-contained
Go project that builds with zero pre-installed dependencies:
build/
├── Makefile
├── go.mod
├── main.go
└── pkg/
├── app/core/loader.go
├── yamlscript/util/loader.go
├── ys/dwim/loader.go
├── ys/std/loader.go
└── ys/v0/loader.go
Anyone can build it with just make - Go is automatically installed.
Cross-Compilation
Use --platform=OS/ARCH to cross-compile for different platforms:
# Linux targets
gloat app.ys -o app-linux-amd64 --platform=linux/amd64
gloat app.ys -o app-linux-arm64 --platform=linux/arm64
# macOS targets
gloat app.ys -o app-darwin-amd64 --platform=darwin/amd64
gloat app.ys -o app-darwin-arm64 --platform=darwin/arm64
# Windows targets
gloat app.ys -o app.exe --platform=windows/amd64
gloat app.ys -o app-win-arm64.exe --platform=windows/arm64
# WebAssembly targets
gloat app.ys -o app.wasm --platform=wasip1/wasm # WASI
gloat app.ys -o app.wasm --platform=js/wasm # JavaScript
Common platform targets:
| OS |
Architectures |
linux |
amd64, arm64, 386, arm |
darwin |
amd64, arm64 |
windows |
amd64, arm64, arm, 386 |
freebsd |
amd64, arm64, 386 |
openbsd |
amd64, arm64 |
netbsd |
amd64, arm64 |
wasip1 |
wasm |
js |
wasm |
Less common platform architectures:
| OS |
Architectures |
linux |
ppc64le, s390x, riscv64, mips64le |
dragonfly |
amd64 |
Options
-t, --to=FORMAT Output format (inferred from -o; see --formats)
-o, --out=FILE Output file or directory
--platform=OS/ARCH Cross-compile (e.g., linux/amd64; see --platforms)
-X, --ext=EXT Enable a processing extension (see --extensions)
--ns=NAMESPACE Override namespace
--module=NAME Go module name (e.g., github.com/user/project)
--formats List available output formats
--extensions List available processing extensions
--platforms List available cross-compilation platforms
-r, --run Compile and run (pass program args after --)
-f, --force Overwrite existing output files
-v, --verbose Print timing for each compilation step
-q, --quiet Suppress progress messages
-h, --help Show help
--version Show version
The Make Shell
The Makefile is set up so that you don't need to install any dependencies.
They get installed the first time they are needed by a rule invoked by a make
command that you run.
However, these tools are only accessible to the Makefile rules that get run
when you use make commands.
In other words, they are NOT available for you to run directly in your shell.
Sometimes you want to run these commands like go, ys and bb directly in
your shell.
In that case, just run: make shell.
This will put you in a subshell with all of those commands available.
Your PS1 shell prompt will be changed so that it will be easy to know you are
in such a subshell.
To leave this environment and get back to the shell that you started in, just
press Ctrl-D or run the exit command.
Copyright and License
Copyright 2026 - Ingy dot Net
MIT License - See License file.