YAMLStar
A YAML framework for all programming languages.
Documentation: https://yamlstar.org
Install
Install the yaml CLI and the libyamlstar shared library:
curl -sSL https://yamlstar.org/install | bash
Install only the CLI or only the shared library:
curl -sSL https://yamlstar.org/install | BIN=1 bash
curl -sSL https://yamlstar.org/install | LIB=1 bash
Install to a custom prefix:
curl -sSL https://yamlstar.org/install | PREFIX=/opt/yamlstar bash
Go users can use the pure-Go module without installing the shared library:
go get github.com/yaml/yamlstar-go
Homebrew is also supported on Linux x64 and macOS ARM64:
brew trust yaml/yamlstar
brew tap yaml/yamlstar
brew install yaml/yamlstar/yamlstar
brew install yaml/yamlstar/libyamlstar
CLI
The yaml command loads YAML and prints compact JSON by default. Use -Y to
emit YAML through YAMLStar's dump stack:
printf 'a: 1\n' | yaml
yaml config.yaml
yaml -J config.yaml
yaml -Y config.yaml
yaml -s stream.yaml
yaml -Y -s stream.yaml
yaml -e 'a: 1' -o out.json
yaml -D parse config.yaml
yaml --version
Run yaml --help or see https://yamlstar.org/cli/ for the full CLI
reference.
Detailed node output (-N) uses node: Document, node: Mapping, and
other node types, including nested content.
The same contract can be passed between YAMLStar and go-yaml:
printf 'a: b\n' | go-yaml -N | yaml -Y
printf 'a: b\n' | yaml -N | go-yaml -Y
Use -f node to force node input.
The retired kind: spelling is not accepted as a detailed node contract.
Vision
YAMLStar aims to be the best YAML load/dump framework available, with these key
features:
- YAML 1.2 Spec Compliance: 100% compliant with the YAML 1.2 specification
- Pure Clojure Parser: No dependencies on SnakeYAML or other external parsers
- Dump Stack: Convert JSON-compatible native values back to YAML
- Cross-Language Consistency: Identical behavior in 32 languages from the
same YAMLStar core
- Highly Configurable: Plugin system for extensibility (coming in Phase 3)
- Lightweight: Minimal dependencies, fast startup, small binaries
Project Status
✅ Phase 1 Complete - Ready for production use with 32 language bindings!
Roadmap
Architecture
YAML Input
↓
Parser (pure Clojure, YAML 1.2)
↓
Composer (events → node tree)
↓
Resolver (nodes → Clojure data)
↓
Output (maps, vectors, scalars)
Dumping follows the reverse stack:
Native Data
↓
Representer (data → node tree)
↓
Desolver (tags/styles for readable YAML)
↓
Serializer (nodes → events)
↓
Emitter (events → YAML text)
↓
YAML Output
Current Status
✅ Phase 1A Complete - Core implementation finished!
- Pure Clojure YAML 1.2 parser integrated (100% spec compliant)
- Event-to-node composer implemented
- Node-to-data resolver implemented
- Complete test suite covering all major features
- Zero external dependencies (except Clojure + data.json)
- Gloat/Glojure shared library (
libyamlstar.so)
- Pure-Go module generated by Gloat/Glojure
- 32 language bindings: Ada, Clojure, Crystal, C#, D, Dart, Delphi, Dyalog APL, Elixir, Erlang, F#, Fortran, Go, Haskell, Java, Julia, Kotlin, Lua, MoonBit, Nim, Node.js, Perl, PHP, PowerShell, Python, R, Raku, Ruby, Rust, Scala, Swift, Zig
Ready for testing! Run make test in the core/ directory, or try any of the language bindings.
Quick Start
Run Tests
The build system automatically installs all dependencies (Gloat, Glojure,
Leiningen, etc.) on first run:
cd core
make test
Use in REPL
cd core
make repl
(require '[yamlstar.core :as yaml])
;; Load a YAML string
(yaml/load "key: value")
;=> {"key" "value"}
;; Load with type coercion
(yaml/load "num: 42\nbool: true\nnull: null")
;=> {"num" 42, "bool" true, "null" nil}
;; Load multiple documents
(yaml/load-all "---\ndoc1\n---\ndoc2")
;=> ["doc1" "doc2"]
;; Dump native values as YAML
(yaml/dump {"foo" [["bar"]]})
;=> "foo:\n- - bar\n"
;; Dump multiple documents
(yaml/dump-all ["doc1" {"a" 1} ["b"]])
;=> "---\ndoc1\n---\na: 1\n---\n- b\n"
;; Complex nested structures
(yaml/load "
person:
name: Alice
age: 30
hobbies: [reading, coding]
")
;=> {"person" {"name" "Alice", "age" 30, "hobbies" ["reading" "coding"]}}
See DEVELOPMENT.md for detailed development guide.
Language Bindings
YAMLStar provides bindings for multiple programming languages from the same
core implementation. Most native bindings use the Gloat/Glojure shared library
(libyamlstar.so); Go uses generated Go code directly.
For language bindings that use FFI, install the matching libyamlstar
release with the install script or Homebrew before loading YAML.
Native Windows support varies by binding. Ada, Crystal, Erlang, F#, Haskell,
Julia, PowerShell, Raku, and Scala are currently verified on Linux/macOS
shared-library paths. FreeBSD x64 verifies the C ABI and Python binding.
| Language |
Directory |
Test Command |
| Ada |
ada/ |
make test (auto-installs GNAT) |
| Clojure |
clojure/ |
make test (auto-installs lein) |
| Crystal |
crystal/ |
make test (auto-installs crystal) |
| C# |
csharp/ |
make test (auto-installs dotnet) |
| Erlang |
erlang/ |
make test (auto-installs Erlang) |
| F# |
fsharp/ |
make test (auto-installs dotnet) |
| Fortran |
fortran/ |
make test (auto-installs gfortran, FPM) |
| Go |
go/ |
make test (auto-installs go) |
| Haskell |
haskell/ |
make test (auto-installs GHC, Cabal) |
| Java |
java/ |
make test (auto-installs lein, Maven) |
| Julia |
julia/ |
make test (auto-installs julia) |
| Lua |
lua/ |
make test (auto-installs lua, luarocks) |
| Node.js |
nodejs/ |
make test (auto-installs node, npm) |
| Perl |
perl/ |
make test (auto-installs perl, cpanm) |
| PHP |
php/ |
make test |
| PowerShell |
powershell/ |
make test (requires or auto-installs pwsh when supported) |
| Python |
python/ |
make test (auto-installs python, pip) |
| Raku |
raku/ |
make test (auto-installs raku) |
| Ruby |
ruby/ |
make test (auto-installs ruby) |
| Rust |
rust/ |
make test (auto-installs cargo) |
| Scala |
scala/ |
make test (requires scala-cli) |
Quick Example (Node.js)
const YAMLStar = require('yamlstar');
const ys = new YAMLStar();
const data = ys.load('key: value');
console.log(data); // { key: 'value' }
const text = ys.dump({foo: [['bar']]});
console.log(text);
// foo:
// - - bar
ys.close();
Quick Example (Python)
from yamlstar import YAMLStar
ys = YAMLStar()
data = ys.load('key: value')
print(data) # {'key': 'value'}
text = ys.dump({'foo': [['bar']]})
print(text)
# foo:
# - - bar
ys.close()
Quick Example (Clojure)
(require '[yamlstar.core :as yaml])
(yaml/load "key: value")
;=> {"key" "value"}
(yaml/dump {"foo" [["bar"]]})
;=> "foo:\n- - bar\n"
Each binding directory contains its own ReadMe.md with detailed installation and usage instructions.
Plugins
YAMLStar has a plugin system that can swap internal processing
components per load operation.
Parser plugins select a parser implementation.
The json-comments plugin API adds JSON-style comments before parsing:
printf '%s\n' '{"a": true /* comment */}' |
yaml --plugin=json-comments
The native CLI installs a missing official shared plugin automatically.
Language bindings require an explicit opt-in before libyamlstar installs
a missing plugin.
See Plugins for the full options
format, installation policy, and plugin ABI.
Comparison to YAMLScript
YAMLStar is derived from YAMLScript but with a different focus:
| Feature |
YAMLScript |
YAMLStar |
| Purpose |
YAML + scripting language |
YAML load/dump framework |
| Runtime |
Includes SCI interpreter |
No runtime evaluation |
| Pipeline |
7 stages (parser → runtime) |
load and dump stacks |
| Dependencies |
Heavy (Babashka, SCI, etc.) |
Minimal (Clojure only) |
| Extensibility |
Built-in scripting |
Plugin system (Phase 3) |
With the related checkouts in repos/, run make speed-diff here or in
repos/yamlscript to compare Glojure HEAD^ and HEAD against GraalVM using
the YAMLScript CLI.
Use make speed-diff old=REF new=REF to select other Glojure commits.
See the comparison guide for workloads,
build isolation, cached binaries, and timing reports.
License
MIT License - See LICENSE file
Credits
Created by Ingy döt Net, inventor of YAML and YAMLScript.
Built on the YAML Reference Parser (pure Clojure implementation).