Source: ViewEdit

SOS Formal Grammar

Standardized Operations Syntax (SOS) replaces loosely defined POSIX guidelines with a strict CFG based on the Standardized Operations Syntax.

Option spelling follows NS-15; switch values follow NS-15 switch kinds. This page summarizes them; where they differ, NS-15 governs.

Switches and values

To prevent "greedy" consumption of positional arguments and ensure unambiguous parsing:

  • REQUIRED: -flag value. Long options use a single dash; a value switch takes its value as the next, space-separated argument.

  • NOT ALLOWED: -flag=value. Hyphen switches never use = (NS-15).

  • DEPRECATED: --flag value. --long is a legacy alias of -long, scheduled for removal in the next major revision of the standard; frameworks MUST warn about it at build time and at run time (NS-15). In Plus Shell native syntax the -- prefix is retired altogether (DECIDED 2026-12-05, NS-15); this bullet is the legacy-shell rule.

Whether a switch takes a value is declared by the tool’s command namespace, so a switch never consumes a positional argument it did not declare. PROPOSED: fixed arity, with no optional values (except level-typed switches, which are DECIDED to take 0 or 1): a plain switch takes 0 values, a value switch exactly 1 (NS-15 switch kinds).

Key Syntax Rules

  1. Short aliases: one letter, -v, -f. There is no implicit bundling: -xvz is the long option xvz; groups are written -x-v-z.

  2. Long options: -verbose, -file path/to/script.

  3. Hyphen-leading values (DECIDED 2026-11-29): bare hyphen-leading tokens are banned as input values. In plush, quote them with double quotes (-output "-final.mkv" instead of -output : -final.mkv). In legacy shells (bash/zsh) where quotes are stripped before argv, positional hyphen-leading values fall back to : or ./. Future shell scripting should pass structured data instead of text-based string parsing.

  4. Values that collide with nodes (and legacy-shell escapes) (DECIDED): a lone : makes the next argument a value, and a lone :: makes the rest of the line values (NS-15 token kinds). This replaces the POSIX -- terminator; repeated dashes are reserved on the legacy path and retired in Plus Shell native syntax.

  5. Ordering (DECIDED): contextual - options may depend on order (NS-7); + free flags are order-independent.

  6. Intensity is a level value (DECIDED 2026-12-05, replaces the repeated-switch, dash-count and ! suffix mechanisms): -clean 2, -verbose 0, with a schema-declared level type (0 to 9 plus low, med, high; 0 means disabled). A level switch takes 0 or 1 value, and the next token is its value only if it is in the declared enum, which is the single exception to fixed arity (NS-15 intensity level). The ! / !! suffix remains only as an optional Plus Shell shorthand, with no ~ fallback; on shells that mangle ! it is simply not available (NS-15 intensity suffix, CH-28).

  7. Nested options and help modes (DECIDED 2026-12-05): / is the generic namespace separator for the legacy form of records and nesting: -video/codec x264, help/i, -help/i (NS-15, CH-27). Dotted names (-video.codec) are not used, because PowerShell splits them. The first segment is at least two letters (-h/i is rewritten by Git Bash and MSYS2). A token that starts with / is a path and nothing else.

  8. PROPOSED: a bare name=value assignment (no hyphen, as in dd if=) where the namespace declares the name (NS-15 switch kinds).