UndoLangLanguage Reference

undo-dsl/1

Small enough to reason about.

Every file contains one or more uniquely named transactions. Inside each transaction the grammar is strict: require*, then mutations, then assert*.

Grammar

program     = transaction+
transaction = "transaction" STRING "{" require* mutation* assert* "}"
require     = "require" condition
assert      = "assert" condition

Operations

Syntax Effect
mkdir PATH Create missing directory parents.
copy SOURCE -> TARGET [overwrite] Stream-copy a regular file or tree.
move SOURCE -> TARGET [overwrite] Move an entry, with verified cross-capability fallback.
write PATH = STRING Create or replace a regular file.
replace PATH OLD -> NEW Literal non-overlapping left-to-right replacement.
delete PATH Delete a file, directory tree, or symlink entry.

Conditions

exists, not_exists, is_file, is_dir, contains PATH TEXT, and sha256 PATH = HEX. SHA-256 is 64 hexadecimal characters. Empty contains and replace needles are invalid.

Strings, comments, paths

Quoted strings support backslash, quote, newline, carriage-return, tab, and \uXXXX escapes. Backtick raw strings keep Windows paths readable. Use # for line comments. There are no variables, imports, loops, functions, shell commands, environment expansion, or network calls.

transaction "windows-config" {
  require is_file `C:\staging\app.conf`
  copy `C:\staging\app.conf` -> `C:\ProgramData\Acme\app.conf` overwrite
  assert is_file `C:\ProgramData\Acme\app.conf`
}