1ay1/vibe
VIBE - A human-friendly configuration format with minimal syntax and fast parsing. No YAML nightmares, no JSON comma catastrophes - just smooth, readable config ๐
VIBE ๐
VIBE (Values In Bracket Expression) is a hierarchical configuration file format designed for human readability and fast machine parsing. It combines the visual clarity of structured formats with the simplicity of minimal syntax.
Like its namesake, VIBE aims to create good vibes in your development workflow by eliminating the frustration of complex configuration formats. No more YAML indentation nightmares or JSON comma catastrophes - just smooth, readable config that flows naturally.
โจ Features
- ๐ฏ Simple Syntax - Only 5 token types, minimal punctuation
- ๐ Visual Hierarchy - Structure is immediately apparent
- โก Fast Parsing - Single-pass O(n) with no backtracking
- ๐ Unambiguous - One canonical way to represent data
- ๐ฌ Comments - Built-in support with
# - ๐ Unicode Support - UTF-8 strings with proper escaping
- ๐จ Flexible Whitespace - No significant indentation rules
- ๐ง Type Inference - Automatic detection of integers, floats, booleans, strings
- ๐ก๏ธ Stability by Design - Arrays of objects are forbidden, forcing stable named entities (see Philosophy)
๐ Quick Example
# Application configuration
application {
name "My Awesome App"
version 2.1.0
debug false
}
server {
host localhost
port 8080
ssl {
enabled true
cert_path /etc/ssl/cert.pem
}
}
# Server pool
servers [
prod1.example.com
prod2.example.com
prod3.example.com
]
# Feature flags
features {
new_ui true
beta_api false
analytics true
}
๐ Quick Start
Installation
git clone https://github.com/1ay1/vibe.git
cd vibe
make๐ฎ Interactive Parsing Tool
VIBE includes a powerful interactive parsing tool with a beautiful TUI (Terminal User Interface) that visualizes the parsing process step-by-step:
make parser_tool
./vibe_parser_tool examples/simple.vibeFeatures:
- ๐ Real-time visualization of parsing steps
- ๐ฏ Current line highlighting with yellow background
- ๐ Token stream analysis with color-coded types
- ๐ Interactive VIBE spec tutorial that teaches as you parse
- ๐ API call tracing with detailed parameters and results
- ๐พ Memory and performance statistics
- โฎ๏ธ Step forward/backward navigation
- ๐จ Modern card-based UI with ASCII art
Keyboard Controls:
SPACE/N- Step forwardB- Step backwardShift+B- Fast backward (rewind to start)F- Fast forward (jump to end)P- Play/Pause auto-play modeR- Reset to beginningQ- Quit
Perfect for learning VIBE syntax, debugging configs, and understanding how the parser works!
Basic Usage
Step 1: Create a VIBE config file (config.vibe):
# My application config
application {
name "My Awesome App"
version 1.0
debug false
}
server {
host localhost
port 8080
ssl {
enabled true
cert /etc/ssl/cert.pem
}
}
servers [
prod1.example.com
prod2.example.com
prod3.example.com
]
Step 2: Parse and use it in C (myapp.c):
#include "vibe.h"
#include <stdio.h>
int main() {
// 1. Create parser
VibeParser* parser = vibe_parser_new();
// 2. Parse the config file
VibeValue* config = vibe_parse_file(parser, "config.vibe");
if (!config) {
VibeError error = vibe_get_last_error(parser);
fprintf(stderr, "Error at line %d: %s\n", error.line, error.message);
vibe_parser_free(parser);
return 1;
}
// 3. Access values using dot notation paths
// Format: "object.nested_object.key"
const char* name = vibe_get_string(config, "application.name");
int64_t port = vibe_get_int(config, "server.port");
bool debug = vibe_get_bool(config, "application.debug");
bool ssl = vibe_get_bool(config, "server.ssl.enabled");
printf("Application: %s\n", name ? name : "Unknown");
printf("Port: %lld\n", (long long)port);
printf("Debug mode: %s\n", debug ? "ON" : "OFF");
printf("SSL: %s\n", ssl ? "enabled" : "disabled");
// 4. Access arrays
VibeArray* servers = vibe_get_array(config, "servers");
if (servers) {
printf("\nServers (%zu total):\n", servers->count);
for (size_t i = 0; i < servers->count; i++) {
VibeValue* server = servers->values[i];
if (server->type == VIBE_TYPE_STRING) {
printf(" %zu. %s\n", i + 1, server->as_string);
}
}
}
// 5. Clean up (frees entire config tree)
vibe_value_free(config);
vibe_parser_free(parser);
return 0;
}Step 3: Compile and run:
gcc -o myapp myapp.c vibe.c -std=c11
./myappOutput:
Application: My Awesome App
Port: 8080
Debug mode: OFF
SSL: enabled
Servers (3 total):
1. prod1.example.com
2. prod2.example.com
3. prod3.example.com
๐ Documentation
Full API Reference
For complete API documentation with detailed examples, see docs/API.md
Quick Links:
- Parser Management - Creating and managing parsers
- Parsing Functions - Parse strings and files
- Value Access - Access values with dot notation
- Object Operations - Working with objects
- Array Operations - Working with arrays
- Memory Management - Cleanup and freeing
- Error Handling - Handling parse errors
- Complete Examples - Full working examples
Syntax Overview
Simple Assignment
key value
Objects
database {
host localhost
port 5432
}
Arrays
ports [8080 8081 8082]
servers [
server1.com
server2.com
server3.com
]
Data Types
- Integers:
42,-17 - Floats:
3.14,-0.5 - Booleans:
true,false - Strings:
"quoted"orunquoted(for simple values)
Comments
# Full line comment
key value # Inline comment
String Escaping
message "Hello \"World\""
path "C:\\Users\\Name"
unicode "Hello ไธ็"
API Reference
Parser Management
VibeParser* vibe_parser_new(void);
void vibe_parser_free(VibeParser* parser);Parsing Functions
VibeValue* vibe_parse_string(VibeParser* parser, const char* input);
VibeValue* vibe_parse_file(VibeParser* parser, const char* filename);Value Access
VibeValue* vibe_get(VibeValue* root, const char* path);
const char* vibe_get_string(VibeValue* value, const char* path);
int64_t vibe_get_int(VibeValue* value, const char* path);
double vibe_get_float(VibeValue* value, const char* path);
bool vibe_get_bool(VibeValue* value, const char* path);
VibeArray* vibe_get_array(VibeValue* value, const char* path);
VibeObject* vibe_get_object(VibeValue* value, const char* path);Object & Array Operations
void vibe_object_set(VibeObject* obj, const char* key, VibeValue* value);
VibeValue* vibe_object_get(VibeObject* obj, const char* key);
void vibe_array_push(VibeArray* arr, VibeValue* value);
VibeValue* vibe_array_get(VibeArray* arr, size_t index);Cleanup
void vibe_value_free(VibeValue* value);Error Handling
VibeError vibe_get_last_error(VibeParser* parser);
void vibe_error_free(VibeError* error);Full Specification
For the complete format specification, see SPECIFICATION.md.
๐ฏ Why VIBE?
| Feature | VIBE | JSON | YAML | TOML |
|---|---|---|---|---|
| Human Readable | โ | โ | โ | โ |
| Minimal Syntax | โ | โ | โ | โ |
| Visual Hierarchy | โ | โ | โ | โ |
| Fast Parsing | โ | โ | โ | โ |
| No Indentation Rules | โ | โ | โ | โ |
| Comments | โ | โ | โ | โ |
| Single Pass Parse | โ | โ | โ | โ |
| No Reserved Words | โ | โ | โ | โ |
Choose VIBE when:
- Configuration files need to be human-readable and editable
- Fast parsing is important
- Visual structure clarity is valued
- Simple syntax is preferred
- You want to avoid indentation sensitivity (YAML) or verbosity (JSON/XML)
๐จ Building & Testing
Build
make # Build everything
make clean # Clean build artifactsRun Examples
make demo # Quick demo
make test # Run all tests
./vibe_example simple.vibe
./vibe_example config.vibeIntegration
To use VIBE in your C project:
- Copy
vibe.handvibe.cto your project - Add
vibe.cto your build system - Include
vibe.hin your source files - Link and compile with C11 support
gcc -std=c11 -c vibe.c
gcc -std=c11 -o myapp myapp.c vibe.o๐ Examples
Check out the examples/ directory for more usage examples:
simple.vibe- Basic configuration with simple arraysconfig.vibe- Complex nested structure using named objectsweb_server.vibe- Web server configuration exampledatabase.vibe- Database configuration with replicasexample.c- Complete C usage example
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Areas for Contribution
- Additional language implementations (Python, Rust, Go, JavaScript)
- Schema validation tools
- Editor plugins (VS Code, Vim, Emacs)
- Conversion tools (JSONโVIBE, YAMLโVIBE, TOMLโVIBE)
- Performance optimizations
- More comprehensive test suite
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐บ๏ธ Roadmap
- Core parser implementation (C)
- Complete specification
- Python bindings
- Rust implementation
- JavaScript/Node.js implementation
- Go implementation
- VS Code syntax highlighting extension
- Schema validation support
- Format converter tools
- Benchmark suite
๐ Support
- ๐ Read the Specification
- ๐ฌ Open an Issue
- ๐ Star the project if you find it useful!
๐ Acknowledgments
Inspired by the need for a configuration format that's:
- Simpler than YAML
- More readable than JSON
- Faster to parse than both
- More flexible than TOML
Keep calm and VIBE on! ๐
Configuration doesn't have to be complicated. Sometimes the best solution is the one that just feels right.
