Expand description
§RESL
A modern configuration and serialization language with variables, expressions, and dynamic runtime evaluation.
RESL = Runtime Evaluated Serialization Language
RESL enables dynamic configuration files with variables, expressions, conditionals, and computed values for flexible configuration management.
§Quick Start
use resl::evaluate;
// Simple evaluation
let result = evaluate("5 + 3").unwrap();
println!("{}", result); // Outputs: 8
// Configuration with variables and logic
let config = r#"
{
port = 8080;
host = "localhost";
debug = true;
url = concat("http://", host, ":", port);
env = ? debug : "development" | "production";
["url": url, "environment": env]
}
"#;
let result = evaluate(config).unwrap();
§Key Features
- Variables & References: Define variables and reference them directly by name
- Function Declaration & Calls: Define and call functions with parameter passing
- Binary Operations: Perform arithmetic, logical, and comparison operations
- Conditional Logic: Use ternary operators
? condition : then | else
- Rich Data Types: Support for strings, numbers, booleans, lists, and maps
- Block Expressions: Group statements and computations in
{}
blocks - Array/Object Access: Index into collections with
[key]
syntax and range slicing - Flexible Structure: Top-level can be any expression, not just objects
§Installation
Add RESL to your Cargo.toml
:
[dependencies]
resl = "0.1"
§Documentation
For comprehensive documentation, examples, and guides, visit: https://decipher3114.github.io/resl
The documentation includes:
- Complete syntax guide with examples
- Language bindings for C/C++ and other languages
- CLI usage and tools
- Best practices and patterns
- Comparison with other configuration formats
Structs§
- CtxState
- Manages all evaluation contexts and string interning.
- Eval
State - State manager for expression evaluation.
- FmtState
- State manager for formatting operations.
- Parse
Error - Represents parsing errors in the RESL language.
Enums§
- Expr
- Represents all possible expressions in the RESL language.
- Value
- Represents the final output values produced by the RESL language interpreter.
Functions§
- evaluate
- Evaluates a RESL expression from a string and returns the computed value.
- evaluate_
and_ format - Evaluates a RESL expression from a string and writes the formatted result to a writer.
- format
- Parses a RESL expression from a string and formats it to a writer.