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

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: 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. Values that look like switches or nodes (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.

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

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