diff options
| author | eunhhu <[email protected]> | 2026-09-25 11:55:47 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-25 11:55:47 +0100 |
| commit | 3265bc65ef6d2e399be6141f678f4f299a2d7491 (patch) | |
| tree | ebeb9661d528dbf99a4b3f68b56580255fe4a7a2 /examples/editor.aup | |
| parent | a6bf235045a5354b00a5021b70de6dad1524f3ef (diff) | |
| download | aup-3265bc65ef6d2e399be6141f678f4f299a2d7491.tar.gz aup-3265bc65ef6d2e399be6141f678f4f299a2d7491.zip | |
Compile messages and keyed documents to module v2
aup now emits Pure module v2 and adds keyed byte collections
(state documents: bytes by key), message inputs by key with u32 and a
trailing bytes field, on-message handlers, field access, name[key] reads
and .bytes sizes, replace(a .. b, value), reply and require, all checked
for number/bytes types with file:line:column diagnostics.
The document editor and its size-bounded variant are rewritten in aup.
make check runs them through pure-edit-module against pure-edit running the
original editor.pure programs: 1,280 random show/edit/apply operations,
including conflicts, limits, missing documents, budgets and invalid keys,
produce byte-identical stdout, stderr and exit codes, and each CLI reads the
other's store identically. v0a parity with the workbench engine, 33
diagnostics and generated/damaged programs still pass, also with a
sanitizer-built compiler.
Diffstat (limited to 'examples/editor.aup')
| -rw-r--r-- | examples/editor.aup | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/editor.aup b/examples/editor.aup new file mode 100644 index 0000000..621c8ba --- /dev/null +++ b/examples/editor.aup @@ -0,0 +1,20 @@ +# Revision-checked byte edits of keyed documents. The runtime owns the +# documents: an edit is a transaction on the key's working version, which +# commits only if the sender's revision is still current. +state documents: bytes by key + +input show = message by key +input edit = message by key { + start: u32 + remove: u32 + insert: bytes +} + +on show { + reply documents[key] +} + +on edit { + documents[key].replace(edit.start .. edit.start + edit.remove, edit.insert) + reply edit.insert +} |
