v1.0 Draft

Human-Readable Configuration Format

DON (Directive Object Notation) is a simple and expressive data serialization format, designed for configuration files, infrastructure as code, and structured documents. Modern alternative to JSON and YAML.

Minimalist syntax with support for primitive types, nested blocks, and multi-line content. Write configurations that are easy to read and maintain.

name "my-application"
version "1.0.0"
port 8080
enabled true

server {
  host "example.com"
  port 443
  
  route /api/* {
    handler "apiHandler"
    timeout 30
  }
}

template <<<HTML
  <!DOCTYPE html>
  <html>
    <body>
      <h1>Welcome</h1>
    </body>
  </html>

Why Choose DON for Your Configuration Files

Minimalist Syntax

  • Fewer special characters, more readability
  • No mandatory quotes on identifiers
  • Comments with # and /* */
  • Simple and expressive directives
🎯

Complete Primitive Types

  • Strings with single or double quotes
  • Numbers: integers, decimals, BigInt
  • Special formats: hex, octal, binary
  • Native booleans and null
🏗️

Hierarchical Structure

  • Nested blocks with braces {}
  • Unlimited nesting depth
  • Organized and clear subdirectives
  • Unambiguous parsing
📝

Built-in Heredocs

  • Multi-line content with delimiters
  • Ideal for HTML, SQL, scripts
  • Preserves format and indentation
  • No need to escape characters
🔄

Repeatable Directives

  • Same directive multiple times
  • Perfect for routers and rules
  • Imperative vs declarative model
  • More expressive than JSON/YAML

Ideal Use Cases

  • Configuration files
  • Security and routing rules
  • Infrastructure as code
  • DSLs and domain-specific languages

Directive Syntax

A directive is a named instruction with optional arguments. It is the fundamental element of DON.

Structure

directive_name [arg1] [arg2] ... [argN]

Examples

  • name "my-app" - Directiva con argumento string
  • port 8080 - Directiva con argumento numérico
  • enabled true - Directiva con argumento booleano
name "my-application"
version "1.0.0"
port 8080
enabled true

Argument Types

# Keywords (Identificadores)
environment production
mode development

# Strings
name "my-application"
path 'C:\Users\file.txt'

# Números
port 8080
timeout 30.5
maxSize 1024n
hex 0xDEADB
octal 0o755
binary 0b1101

# Booleanos
enabled true
deprecated false

# Null
value null

Directive arguments can be of different primitive types, allowing values to be expressed naturally and readably.

Supported Types

Keywords (Identifiers)

Simplified strings without quotes for greater simplicity. Must start with a letter or underscore, can contain letters, numbers, and underscores.

Strings

Text delimited by single or double quotes. Supports escape sequences.

Numbers

Integers, decimals, BigInt (suffix 'n'), hexadecimal (0x), octal (0o), and binary (0b). Supports negative values.

Booleans

Logical values true or false (case-sensitive).

Null

Represents absence of value with the null keyword.

Nested Directives

Directives can contain subdirectives using blocks delimited by braces, allowing you to create complex hierarchical structures.

Benefits

Hierarchical Organization

Group related directives into logical blocks, improving code readability and maintainability.

Unlimited Nesting

You can nest blocks to any depth, allowing you to model complex data structures.

Clear Syntax

Braces {} clearly define the start and end of each block, with no ambiguity in parsing.

server {
  host "example.com"
  port 443
  
  route /api/* {
    handler "apiHandler"
    timeout 30
    
    middleware {
      auth true
      cors {
        origin "*"
        methods "GET, POST"
      }
    }
  }
  
  route /static/* {
    handler "staticHandler"
    cache true
  }
}

Heredocs

template <<<HTML
  <!DOCTYPE html>
  <html>
    <head>
      <title>My Page</title>
    </head>
    <body>
      <h1>Welcome</h1>
    </body>
  </html>

script <<<BASH
  #!/bin/bash
  echo "Deploying..."
  npm run build
  
query <<<SQL
  SELECT * FROM users
  WHERE status = "active"
  ORDER BY created_at DESC

Heredocs allow you to include multi-line content with a custom delimiter, ideal for templates, scripts, and embedded documents.

Syntax

directive <<<DELIMITER
  content line 1
  content line 2

Features

Custom Delimiter

Define your own delimiter (HTML, SQL, BASH, etc.) to identify the content type.

Preserves Format

Maintains indentation and line breaks from the original content, perfect for embedded code.

No Escaping Required

No need to escape quotes or special characters inside the heredoc.