FON (Fer Object Notation) is a lightweight data representation format and a declarative subset of the Fer Programming Language. This repository contains official FON parser implementations across multiple programming languages, engineered for high-performance data interchange and elegant configuration management.
FON is designed to be human-readable, visually structured, and minimal.
- Strings: Defined exclusively with backticks:
`string` - Numbers: Defined as raw numeric values:
20 - Booleans: Defined as logical values:
trueorfalse - Arrays: Defined using square brackets:
[123, 456] - Objects/Structs: Defined using braces with key-value pairs:
{ key = value } - Comments: Supported via double slashes:
// Comment
Important
By default, FON is a multi-line, two-dimensional format that uses newlines (\n) as delimiters. For one-dimensional (flattened) representations, commas (,) are used as separators. Note that flattened FON does not support comments.
FON can operate as a standalone data format or integrate with a predefined Fer schema for strict type validation. In this mode, values are validated against Fer's robust type system, including enums, structs, and fixed-width primitives.
Example Schema Definition:
/// @/config/app-appearance.fer
{ Hex } = @fer/ueiby
AppMode: enum = { dark, light, contrast, auto }
AppAppearance: struct = {
mode: AppMode
primary-color: Hex = #AEA4E4
secondary-color: Hex = #ffe710
font-size: u8 = 14
enable-animations = true
}
exports { AppMode, AppAppearance }
Usage with Schema Validation:
{ AppMode, AppAppearance } = @/config/app-appearance
appconf: AppAppearance {
mode = AppMode.dark
primary-color = #AEA4E4
secondary-color = 100 // Error: Does not match Hex type
font-size = -100 // Error: Does not match u8 (unsigned) type
}
Note: While the FON parser extracts raw data, type validation against the schema is handled by the specific language implementation or the Fer compiler.
Multi-line (Standard)
name = @fer/std
version = 0.1.0
license = mit
authors = [`Fuyeor`, `AI`]
description = `The standard library`
dependencies = {
@fer/common = ^0.1.0
}
readme = { en = ./docs/en.md, fr = ./docs/fr.md }
One-dimensional (Flattened)
name = @fer/std, version = 0.1.0, license = mit, authors = [`Fuyeor`, `AI`], dependencies = { @fer/common = ^0.1.0 }
- TypeScript/JavaScript: Native support for Web, Node.js, and Deno.
- Rust: High-performance, zero-copy, memory-safe implementation.
- Python: Clean and idiomatic parser for scripting and data science.
The shared FON Core fixture suite keeps independent language implementations aligned. Rust and TypeScript runners parse the same inputs and compare language-neutral AST projections instead of implementation-private node IDs or offsets.
Run the conformance checks with:
cargo test --manifest-path rust/Cargo.toml --features json --test conformance
pnpm --dir typescript test