Basic syntax

Last updated: 2026-10-14Pairs, nesting, lists, multiline text, comments and type casting — everything that works without !active.

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.

synx
name John
age 25
phrase I love programming and drinking coffee!

JSON equivalent:

json
{
  "name": "John",
  "age": 25,
  "phrase": "I love programming and drinking coffee!"
}

Key rules:

  • No spaces (use _ or camelCase)
  • Cannot start with -, #, //, !
  • May contain letters of any alphabet, digits, _, - (inside)

2.2 Automatic Type Detection

The parser detects types automatically:

synx
greeting Hello World
count 42
rate 3.14
enabled true
disabled false
empty null

Result:

json
{
  "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):

synx
zip_code(string) 90210
id(int) 007

Supported 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).

synx
server
  host 0.0.0.0
  port 8080
  ssl
    enabled true
    cert /etc/ssl/cert.pem

Result:

json
{
  "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.

synx
inventory
  - Sword
  - Shield
  - Health Potion

Result:

json
{
  "inventory": ["Sword", "Shield", "Health Potion"]
}

List of objects (each item is a mini-record):

synx
garage
  - make BMW
    color black
    year 2023
  - make Audi
    color white
    year 2021

Result:

json
{
  "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.

synx
description |
  This is a long description
  that spans multiple lines.
  Each line is joined with a newline character.

Result:

json
{
  "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

synx
banner Welcome!/nEnjoy the game!

Result:

Welcome!
Enjoy the game!

2.6 Comments

Two styles are supported:

synx
# This is a comment (Python/YAML style)
// This is also a comment (JS/C++ style)

name John  # Inline comment after value
port 8080 // Also inline

Comments are completely ignored by the parser.

Basic syntax | AS Docs