mon-core is the reference Rust implementation of the MON (Mycel Object Notation) language — a human-focused configuration and data format designed to be readable, safe, and predictable.
This crate provides the parser, analyzer, validator, and core data model used by MON-based tooling, servers, CLIs, and compilers.
for more information please look at out website: www.mycel-lang.org
MON aims to replace overly rigid formats (JSON) and overly permissive ones (YAML) with a syntax that stays readable without giving up safety or predictability.
mon-core implements:
- A forgiving parser with clear, context-rich error messages
- A semantic analyzer with anchor/alias resolution
- Type checking via
#struct,#enum, and validated bindings - An internal IR suitable for compilers and higher-level tooling
If you want to embed MON into your Rust application or build tooling around the language, this is the crate.
For more information about mon docs are here :D
- Clean syntax: unquoted keys, comments, trailing commas
- Human-friendly booleans:
on/offas well astrue/false - Anchors & aliases: safe reuse with explicit copy semantics (
&name,*name) - Deep merges:
...*anchorfor structured overrides - Types built in:
#struct,#enum, and::for validation - Modular imports:
import { A, B } from "./file.mon" - Detailed errors: location-aware, colorized, actionable
import { ServerSettings } from "./schemas.mon"
{
&base: {
host: "localhost",
port: 8080,
},
User: #struct {
id(Number),
name(String),
roles([String...]),
},
admin :: User = {
id: 1,
name: "Alice",
roles: ["admin", "editor"],
},
dev: {
...*base,
port: 9001,
debug: on,
},
}
Add to Cargo.toml:
[dependencies]
mon-core = "0.1"Parse and analyze:
use mon_core::analyze;
fn main() {
let text = r#"
settings: {
name: "Example",
enabled: on,
}
"#;
match analyze(text, "config.mon") {
Ok(result) => {
println!("JSON:\n{}", result.to_json().unwrap());
}
Err(err) => {
eprintln!("MON error:\n{err}");
}
}
}MON is designed to fail loudly and helpfully.
Example error (format depends on your terminal capabilities):
error[E0012]: expected Number, got String
--> config.mon:7:12
|
6 | age: "twenty",
| ^^^ expected a Number hereErrors include:
- the source span
- the inferred and expected types
- suggestions when applicable
Build:
cargo buildTest:
cargo test --all-featuresChecks:
cargo checkThe project follows standard Rust layout.
Documentation lives in docs/. Any language or spec changes must be reflected there.
- Improved parser recovery modes
- Type system stabilization
- Performance pass on alias/anchor resolution
- Better import graph validation
- Tooling support (formatter, LSP)
Licensed under the MIT license.
See LICENSE for details.
for more information please look at out website: www.mycel-lang.org
Made with ❤️