Skip to content
/ spec Public

The universal specification for Simple Structured Markup Language (SSM)

License

Notifications You must be signed in to change notification settings

ssmlang/spec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

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:

  • Ungrouped Values: Key-value pairs that are not grouped, written outside any [group] section.
  • Grouped Values: Key-value pairs grouped under a [group_name] declaration.
  • Comments: Text comments that begin with a #. Example:
# 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

  • Assign values to keys using the syntax: key = value.
  • Keys are alphanumeric and can contain underscores (_), but no whitespace.
  • Values can be:
    • Strings: Enclosed in double quotes ("...").
    • Integers: A sequence of digits (1234).

Example:

name = "Simple Structured Markup"
version = 1

2.2 Groups

  • Groups are declared by enclosing a group name in square brackets ([group_name]).
  • Group names are alphanumeric and can contain underscores (_).
  • Values under a group apply to the current group until a new group is defined or the file ends.

Example:

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

[group2]
count = 5

2.3 Comments

  • Comments start with # and continue to the end of the line.
  • Comments can appear:
    • On a line by themselves.
    • At the end of a key-value assignment.

Example:

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

3. Data Types

  • String: Text wrapped in double quotes. SSM allows any characters within double quotes, including numbers, which will be treated as strings.
    • Example: title = "Hello, World!"
  • Integer: A sequence of digits representing a whole number, without quotes.
    • Example: version = 2

4. Rules and Constraints

  1. Key Syntax:
  • Must start with a letter or underscore.
  • Only alphanumeric characters and underscores are allowed (no spaces).
  1. Group Syntax:
  • Must start with a letter or underscore.
  • Enclosed in square brackets ([group_name]).
  • Group name must not contain spaces.
  1. 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").
  1. Comment Syntax:
  • Begins with # and can be placed on any line.
  • Inline comments must be preceded by at least one space.
  1. No Nesting:
  • SSM does not support nested groups or complex data types like arrays or dictionaries.
  1. 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

  • Parser Considerations:
    • An SSM parser should recognize lines starting with # as comments.
    • Group declarations (e.g., [group_name]) indicate that all subsequent key-value pairs belong to that group until a new group or end of file.
    • Ungrouped values are interpreted as global or general configuration settings.

About

The universal specification for Simple Structured Markup Language (SSM)

Resources

License

Stars

Watchers

Forks

Releases

No releases published