Basic syntax
Mirrored from the format repository — docs/spec/SPECIFICATION_EN.md, SYNX 3.7.4. Changes are made there.
2.1 Key–Value
Everything after the first space is the value. No quotes needed.
name John
age 25
phrase I love programming and drinking coffee!JSON equivalent:
{
"name": "John",
"age": 25,
"phrase": "I love programming and drinking coffee!"
}Key rules:
- No spaces (use
_orcamelCase) - Cannot start with
-,#,//,! - May contain letters of any alphabet, digits,
_,-(inside)
2.2 Automatic Type Detection
The parser detects types automatically:
greeting Hello World
count 42
rate 3.14
enabled true
disabled false
empty nullResult:
{
"greeting": "Hello World",
"count": 42,
"rate": 3.14,
"enabled": true,
"disabled": false,
"empty": null
}Explicit type casting (if you need a number as a string):
zip_code(string) 90210
id(int) 007Supported casts: (int), (float), (bool), (string)
2.3 Nesting (objects)
An indent of 2 spaces creates a nested object. A key without a value is a group (folder).
server
host 0.0.0.0
port 8080
ssl
enabled true
cert /etc/ssl/cert.pemResult:
{
"server": {
"host": "0.0.0.0",
"port": 8080,
"ssl": {
"enabled": true,
"cert": "/etc/ssl/cert.pem"
}
}
}⚠️ Use spaces, not TABs. The standard is 2 spaces per level.
2.4 Lists
The - (dash + space) symbol creates a list item. Items without names form an ordered collection.
inventory
- Sword
- Shield
- Health PotionResult:
{
"inventory": ["Sword", "Shield", "Health Potion"]
}List of objects (each item is a mini-record):
garage
- make BMW
color black
year 2023
- make Audi
color white
year 2021Result:
{
"garage": [
{ "make": "BMW", "color": "black", "year": 2023 },
{ "make": "Audi", "color": "white", "year": 2021 }
]
}2.5 Multiline Text (blocks)
The | character after a key starts a text block. Everything indented below is part of that text.
description |
This is a long description
that spans multiple lines.
Each line is joined with a newline character.Result:
{
"description": "This is a long description\nthat spans multiple lines.\nEach line is joined with a newline character."
}Forced line break inside a single line: /n
banner Welcome!/nEnjoy the game!Result:
Welcome!
Enjoy the game!2.6 Comments
Two styles are supported:
# This is a comment (Python/YAML style)
// This is also a comment (JS/C++ style)
name John # Inline comment after value
port 8080 // Also inlineComments are completely ignored by the parser.