Skip to main content

Crate nbcl

Crate nbcl 

Source
Expand description

§NBCL - Node Based Configuration Language

nbcl is a lightweight, declarative configuration DSL mainly designed for defining UI components and cloud infrastructure. The syntax is designed to be simple, and thus follows an HCL-inspired Blocky syntax but with the added benifits of modularity, scripting capabilities, and simplicity.

§Example

use nbcl::NbclEngine;

fn main() {
    let code = r#"
        print("Hello, World")

        Object "language" {
            name = "nbcl"
            website = "nbcl-lang.github.io"
            playground = "nbcl-lang.github.io/playground"
            documnetation = "nbcl-lang.github.io/docs"
        }
    "#;

    let engine = NbclEngine::new();
    match engine.evaluate(code) {
        Ok(cfg) => println!("Resolved config: {:#?}", cfg),
        Err(e) => println!("Error: {}", e)
    }
}

Modules§

ast
AST components used across the crate
context
error
Module responsible for all the error handling in Nbcl
library
API’s for registering new Library that can be imported and used
module_resolver
Module resolver for handling import statements

Structs§

NativeFnSchema
Public structure used for registering custom functions.
NativeNodeSchema
Public structure used for registering custom nodes.
NbclEngine
Nbcl Engine used for parsing and evaluation

Enums§

PropValidation
Defines a host-provided node
Type
Possible data types in Nbcl (used for type hints)
Value
Possible data types in Nbcl (used to hold value)

Functions§

print
Print a message that automatically goes to right buffer.