Skip to main content

VIBEE Specification Format

Complete reference for .vibee specification files.

File Structure​

Every .vibee file follows this YAML structure:

name: module_name
version: "1.0.0"
language: zig # Target language
module: module_name # Output module name

constants:
KEY: value

types:
TypeName:
fields:
field1: Type
constraints:
- "validation rule"

behaviors:
- name: function_name
given: Precondition
when: Action
then: Expected result
params:
- name: param1
type: Type
test_cases:
- name: test_name
input: {...}
expected: {...}

Header Section​

Required Fields​

FieldTypeDescription
nameStringSpecification name (lowercase, underscores)
versionStringSemantic version ("1.0.0")
languageStringTarget: zig, varlog, python, etc.
moduleStringOutput module name

Optional Fields​

FieldTypeDescription
descriptionStringHuman-readable description
authorStringAuthor name
licenseStringLicense identifier

Constants Section​

Define compile-time constants:

constants:
PHI: 1.6180339887498948
TRINITY: 3
DIMENSION: 10000
PE_MAGIC: 0x5A4D

Constants can be:

  • Numbers: Integer or floating-point
  • Strings: Quoted text
  • Hex: Prefixed with 0x

Types Section​

Basic Types​

VIBEE TypeZigVerilogPython
String[]const u8N/Astr
Inti64integerint
Floatf64realfloat
Boolboolregbool
Option<T>?TN/AOptional[T]
List<T>[]TN/AList[T]

Struct Definition​

types:
Point:
fields:
x: Float
y: Float
z: Float

Generates (Zig):

pub const Point = struct {
x: f64,
y: f64,
z: f64,
};

Enum Definition​

types:
BinaryFormat:
enum:
- pe64
- elf64
- macho64
- wasm

Generates (Zig):

pub const BinaryFormat = enum {
pe64,
elf64,
macho64,
wasm,
};

Constraints​

types:
TritValue:
fields:
value: Int
constraints:
- "value >= -1"
- "value <= 1"

Hardware Types (Verilog)​

For language: varlog:

types:
Register:
fields:
data: Int
width: 8 # Bit width
direction: input # input/output/inout

Behaviors Section​

Behaviors follow Given-When-Then (BDD) semantics:

behaviors:
- name: bind
given: Two vectors a and b of same dimension
when: Binding (element-wise multiplication)
then: Returns vector c where c[i] = a[i] * b[i]

Full Behavior Structure​

behaviors:
- name: function_name
given: Precondition description
when: Action description
then: Expected result
params:
- name: input
type: Vector
- name: dimension
type: Int
returns: Vector
test_cases:
- name: test_basic
input:
input: [1, 0, -1]
dimension: 3
expected: [1, 0, -1]

Hardware Signals (Verilog)​

signals:
- name: clk
width: 1
direction: input
- name: data_out
width: 8
direction: output
- name: data_bus
width: 32
direction: inout

Language Targets​

Zig (Default)​

language: zig

Output: trinity/output/*.zig

Verilog (FPGA)​

language: varlog

Output: trinity/output/fpga/*.v

Multi-language​

./bin/vibee gen-multi specs/tri/feature.vibee all

Generates for all 42 supported languages.

Example: Complete Specification​

name: trit_vector
version: "1.0.0"
language: zig
module: trit_vector
description: High-dimensional ternary vector operations

constants:
DEFAULT_DIM: 10000
VALID_VALUES: [-1, 0, 1]

types:
Trit:
fields:
value: Int
constraints:
- "value >= -1"
- "value <= 1"

TritVector:
fields:
data: List<Int>
dimension: Int

behaviors:
- name: create
given: A dimension size
when: Creating a new vector
then: Returns zeroed TritVector of given dimension
params:
- name: dim
type: Int
returns: TritVector

- name: bind
given: Two TritVectors of same dimension
when: Performing element-wise multiplication
then: Returns bound vector
params:
- name: a
type: TritVector
- name: b
type: TritVector
returns: TritVector
test_cases:
- name: test_bind_identity
input:
a: {data: [1, 0, -1], dimension: 3}
b: {data: [1, 1, 1], dimension: 3}
expected: {data: [1, 0, -1], dimension: 3}

CLI Commands​

# Generate Zig code
./bin/vibee gen specs/tri/feature.vibee

# Generate for all languages
./bin/vibee gen-multi specs/tri/feature.vibee all

# Validate specification
./bin/vibee validate specs/tri/feature.vibee

# Show Golden Chain workflow
./bin/vibee koschei