Home /Modules/data-structures/DATA_STRUCTURES.md

DATA_STRUCTURES.md

data-structures/DATA_STRUCTURES.md · 126 line(s) · markdown

Data Structure Correspondence

The SLeeLa data-structure layer provides a language-level counterpart to the native C/C++ contracts in this directory. The concrete SLeeLa declarations are split into one source file per structure so the Compiler/Loader can discover each object independently.

1. Value

Java-like values are represented as a discriminated value in the native layers.

2. Ordered sequence

The sequence contract is:

C uses manually managed contiguous storage. C++ uses std::vector. SLeeLa exposes the semantic object and operation names so a later compiler/runtime implementation can lower them to the native representation.

3. Stack

The stack contract is LIFO:

This directly corresponds to the VM operand-stack concept.

4. Queue

The queue contract is FIFO:

The C implementation uses a circular buffer. C++ uses std::deque.

5. Map

The map contract associates a string key with a value:

The reference implementations intentionally use straightforward storage rather than hiding the semantics behind a large framework.

6. Object record

An object record contains:

This is the native counterpart of a Java-like object whose state is a collection of named fields.

7. SLeeLa operation and test surface

The SLeeLa module now separates the structure declarations from the aggregate operation facade and its source-level contract test:

SLeeLa sourceResponsibility
DSValue.sleelaTagged value representation and constructors
DSList.sleelaOrdered sequence state and operations
DSStack.sleelaLIFO state and operations
DSQueue.sleelaFIFO state and operations
DSMap.sleelaKey/value map state and operations
DSObject.sleelaNamed object-record state and operations
DataStructures.sleelaAggregate cross-structure facade
DataStructuresTest.sleelaSLeeLa source-level contract exercise

Every one of these files is present in both /data-structures and /lib/data-structures. The duplicate library path intentionally exposes the same semantic surface through the SLeeLa standard-library front end while retaining the module source organization.

Invariants

All implementations preserve:

Relationship to the existing VM

The current VM already has:

The data-structures directory is therefore a correspondence layer, not a second VM. It gives those concepts stable data-structure names and cross-language reference implementations.

Source-of-truth rule

The individual .sleela files are the authoritative SLeeLa source for the structures. The existing data_structures.sleela file remains as the legacy aggregate module source; new per-structure files provide the explicit Compiler/Loader discovery surface.

SLeeLa — MEARVK LLC — 2026