diff options
Diffstat (limited to 'research/experiments')
12 files changed, 74 insertions, 0 deletions
diff --git a/research/experiments/044-specs/2026-10-13-probes.tsv b/research/experiments/044-specs/2026-10-13-probes.tsv new file mode 100644 index 0000000..71b6de0 --- /dev/null +++ b/research/experiments/044-specs/2026-10-13-probes.tsv @@ -0,0 +1,10 @@ +p1-byte.aup p1-byte.aup:4:22: expected newline or semicolon +p2-bits.aup p2-bits.aup:4:10: unexpected character '^' +p2b-bits.aup p2b-bits.aup:4:9: unexpected character '&' +p3-nested.aup p3-nested.aup:2:10: expected a numeric field default +p3b-nested.aup p3b-nested.aup:6:7: a field is a number (field = 0), a bool (field = false), text (field: text) or an i64 (field: i64) +p4-rec.aup p4-rec.aup:1:42: fn 'depth' calls itself (in fn 'depth' called at 2:10) +p5-chars.aup p5-chars.aup:4:12: unknown list 'line.t' +p5b-chars.aup p5b-chars.aup:4:17: expected newline or semicolon +p5c-cursor.aup p5c-cursor.aup:6:12: unknown library 'note'; write use note first +p6-variant.aup p6-variant.aup:2:15: unexpected character '|' diff --git a/research/experiments/044-specs/probes/p1-byte.aup b/research/experiments/044-specs/probes/p1-byte.aup new file mode 100644 index 0000000..0a5ad6e --- /dev/null +++ b/research/experiments/044-specs/probes/p1-byte.aup @@ -0,0 +1,5 @@ +state first = 0 +input packet = message { data: bytes } +on packet { + first = packet.data[0] +} diff --git a/research/experiments/044-specs/probes/p2-bits.aup b/research/experiments/044-specs/probes/p2-bits.aup new file mode 100644 index 0000000..569825f --- /dev/null +++ b/research/experiments/044-specs/probes/p2-bits.aup @@ -0,0 +1,5 @@ +state h = 0 +input word = message { w: u32 } +on word { + h = (h ^ word.w) << 3 +} diff --git a/research/experiments/044-specs/probes/p2b-bits.aup b/research/experiments/044-specs/probes/p2b-bits.aup new file mode 100644 index 0000000..e432668 --- /dev/null +++ b/research/experiments/044-specs/probes/p2b-bits.aup @@ -0,0 +1,5 @@ +state h: i64 = 0 +input word = message { w: i64 } +on word { + h = h & word.w +} diff --git a/research/experiments/044-specs/probes/p3-nested.aup b/research/experiments/044-specs/probes/p3-nested.aup new file mode 100644 index 0000000..c80a343 --- /dev/null +++ b/research/experiments/044-specs/probes/p3-nested.aup @@ -0,0 +1,5 @@ +record Node { + name = "" + children: list of Node +} +state root: list of Node diff --git a/research/experiments/044-specs/probes/p3b-nested.aup b/research/experiments/044-specs/probes/p3b-nested.aup new file mode 100644 index 0000000..105da0a --- /dev/null +++ b/research/experiments/044-specs/probes/p3b-nested.aup @@ -0,0 +1,8 @@ +record Point { + x = 0 + y = 0 +} +record Box { + at: Point +} +state boxes: list of Box diff --git a/research/experiments/044-specs/probes/p4-rec.aup b/research/experiments/044-specs/probes/p4-rec.aup new file mode 100644 index 0000000..753eaff --- /dev/null +++ b/research/experiments/044-specs/probes/p4-rec.aup @@ -0,0 +1,2 @@ +fn depth(n) = if n == 0 { 0 } else { 1 + depth(n - 1) } +view d = depth(3) diff --git a/research/experiments/044-specs/probes/p5-chars.aup b/research/experiments/044-specs/probes/p5-chars.aup new file mode 100644 index 0000000..95f5c6b --- /dev/null +++ b/research/experiments/044-specs/probes/p5-chars.aup @@ -0,0 +1,7 @@ +state count = 0 +input line = message { t: text } +on line { + for c in line.t { + count = count + 1 + } +} diff --git a/research/experiments/044-specs/probes/p5b-chars.aup b/research/experiments/044-specs/probes/p5b-chars.aup new file mode 100644 index 0000000..c5bc23b --- /dev/null +++ b/research/experiments/044-specs/probes/p5b-chars.aup @@ -0,0 +1,5 @@ +state first: text +input line = message { t: text } +on line { + first = line.t[0] +} diff --git a/research/experiments/044-specs/probes/p5c-cursor.aup b/research/experiments/044-specs/probes/p5c-cursor.aup new file mode 100644 index 0000000..97a73f9 --- /dev/null +++ b/research/experiments/044-specs/probes/p5c-cursor.aup @@ -0,0 +1,7 @@ +state note: text +state at: cursor in note +state c: text +input next = key ArrowRight +on next.down { + c = note.char(at) +} diff --git a/research/experiments/044-specs/probes/p6-variant.aup b/research/experiments/044-specs/probes/p6-variant.aup new file mode 100644 index 0000000..35f12fc --- /dev/null +++ b/research/experiments/044-specs/probes/p6-variant.aup @@ -0,0 +1,2 @@ +record Leaf { v = 0 } +state x: Leaf | text = "" diff --git a/research/experiments/044-specs/run.sh b/research/experiments/044-specs/run.sh new file mode 100755 index 0000000..670d0a7 --- /dev/null +++ b/research/experiments/044-specs/run.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Research 140: compile each probe with aup and print what it says. A probe is +# the first thing a spec in the suite needs (a byte at a position, a bit +# operation, a record inside a record, a call to itself, a variant, a +# character at a position). AUP is the aup checkout (default ../aup beside +# Pure); the output is the evidence table in 140. +set -u +here=$(cd "$(dirname "$0")" && pwd) +aup=${AUP:-$here/../../../../aup}/build/aup +for f in "$here"/probes/*.aup; do + printf '%s\t' "$(basename "$f")" + if out=$("$aup" build "$f" -o /dev/null 2>&1); then echo "compiles"; else echo "$out" | head -1 | sed "s|^$here/probes/||"; fi +done |
