DownloadATON Format Specification V1
Overview
ATON (Adaptive Token-Oriented Notation) is a data serialization format optimized for LLM token efficiency. Version 1 provides the core encoding/decoding functionality.
Format Structure
Basic Syntax
@schema[field1:type1, field2:type2, ...]
tableName(recordCount):
value1, value2, ...
value1, value2, ...
Schema Definition
The schema defines the structure of records:
@schema[id:int, name:str, price:float, active:bool]
Supported Types
| Type | Description | PHP Type | Example |
|------|-------------|----------|---------|
| int | Integer numbers | int | 42, -7 |
| float | Floating point | float | 3.14, -0.5 |
| str | Strings | string | "hello" |
| bool | Boolean | bool | true, false |
| null | Null value | null | null |
Data Section
Records are listed under a table header with count:
products(3):
1, "Laptop", 999.99, true
2, "Mouse", 29.99, true
3, "Keyboard", 79.99, false
Encoding Rules
Strings
-
Always quoted with double quotes: `"hello world"`
-
Escape internal quotes: `"He said \"hello\""`
Numbers
-
Integers: no decimal point: `42`
-
Floats: with decimal point: `3.14`
Booleans
-
Lowercase: `true` or `false`
Null
Example
JSON Input
{
"users": [
{"id": 1, "name": "Alice", "email": "alice@example.com", "verified": true},
{"id": 2, "name": "Bob", "email": "bob@example.com", "verified": false}
]
}
ATON Output
@schema[id:int, name:str, email:str, verified:bool]
users(2):
1, "Alice", "alice@example.com", true
2, "Bob", "bob@example.com", false
PHP Usage (V1 Style)
use Aton\Encoder;
use Aton\Decoder;
use Aton\Enums\CompressionMode;
// Create encoder without compression (V1 style)
$encoder = new Encoder(
optimize: false,
compression: CompressionMode::FAST
);
$data = [
'users' => [
['id' => 1, 'name' => 'Alice'],
['id' => 2, 'name' => 'Bob'],
]
];
$aton = $encoder->encode($data);
// Decode
$decoder = new Decoder();
$decoded = $decoder->decode($aton);
Token Efficiency
V1 achieves approximately 40-50% token reduction compared to JSON through:
-
Schema extraction: Field names defined once
-
Compact syntax: No braces, brackets, or colons in data
-
Minimal punctuation: Only commas between values
-
No redundancy: Each piece of information appears once
Limitations of V1
-
No dictionary compression for repeated strings
-
No default values optimization
-
No query language support
-
No streaming for large datasets
These limitations are addressed in V2.
|