spec

SSM Specification Version 1.1

Overview

SSM is a lightweight markup language for simple configurations. It supports value assignments, groupings, and comments in a human-readable format similar to INI files, with a more straightforward syntax.

1. File Structure

An SSM file consists of:

# This is an ungrouped value
example_value = "Hello, SSM!"

[group_name]
key1 = 42
key2 = "A grouped string"

2. Basic Elements

2.1 Key-Value Assignment

Example:

name = "Simple Structured Markup"
version = 1

2.2 Groups

Example:

[group1]
setting1 = 100
setting2 = "Grouped text"

[group2]
count = 5

2.3 Comments

Example:

# This is a standalone comment
name = "SSM" # This is an inline comment

3. Data Types

4. Rules and Constraints

  1. Key Syntax:
    • Must start with a letter or underscore.
    • Only alphanumeric characters and underscores are allowed (no spaces).
  2. Group Syntax:
    • Must start with a letter or underscore.
    • Enclosed in square brackets ([group_name]).
    • Group name must not contain spaces.
  3. Value Syntax:
    • Integers are written directly without quotes (e.g., number = 42).
    • Strings are enclosed in double quotes (e.g., text = "hello").
    • Mixing integers and strings in a single value requires quoting (e.g., mixed = "123abc").
  4. Comment Syntax:
    • Begins with # and can be placed on any line.
    • Inline comments must be preceded by at least one space.
  5. No Nesting:
    • SSM does not support nested groups or complex data types like arrays or dictionaries.
  6. Line Breaks:
    • Each key-value pair or group declaration must be on its own line.

5. Examples

Example 1: Basic File Structure

# An ungrouped key-value pair
application_name = "MyApp"

[general]
version = 1
description = "This is a simple app."

[database]
host = "localhost"
port = 5432

Example 2: Mixed Value Types

name = "Sample Config" # App name as a string
timeout = 30 # Timeout in seconds as an integer

[server]
ip = "192.168.1.1"
port = 8080

[logging]
log_level = "info"
max_file_size = 1048576

6. Parsing and Usage Notes