Browse code

WIP: Add the fruits of running our UM on the codex

Robert Cranston authored on 20/04/2026 04:10:52
Showing 2 changed files

... ...
@@ -7,3 +7,5 @@
7 7
 /um.um
8 8
 /um-spec.txt
9 9
 /um
10
+/umix.um
11
+/publications.txt
... ...
@@ -1,7 +1,7 @@
1 1
 .POSIX:
2 2
 
3 3
 .PHONY: all
4
-all: um
4
+all: publications.txt
5 5
 
6 6
 .PHONY: test
7 7
 
... ...
@@ -44,3 +44,32 @@ test: um sandmark.umz sandmark-output.txt
44 44
 	{ time ./um sandmark.umz; } \
45 45
 	| tee /dev/tty \
46 46
 	| diff -q sandmark-output.txt -
47
+
48
+umix.um: um codex.umz codex-key.txt
49
+	# It's faster if we don't output to `/dev/tty`, but it looks cool.
50
+	{ cat codex-key.txt; echo 'p'; } \
51
+	| { time ./um codex.umz; } \
52
+	| { tee /dev/stderr | cat -v > /dev/tty; } 2>&1 \
53
+	| LC_ALL=C awk ' \
54
+	  program; \
55
+	  !program && program = match($$0, /UM program follows colon:/) { \
56
+	    print substr($$0, RSTART+RLENGTH); \
57
+	  } \
58
+	' > $@
59
+	echo
60
+
61
+.PHONY: publications.txt
62
+.PRECIOUS: publications.txt
63
+publications.txt: um umix.um
64
+	publications=$$(cat $@); \
65
+	{ \
66
+	  ! [ "$$publications" ] || echo "$$publications"; \
67
+	  { time ./um umix.um; } \
68
+	  | tee /dev/tty \
69
+	  | awk ' \
70
+	    match($$0, /[A-Z]{5}\.[A-Z]{3}=[0-9]+@[0-9]+\|[0-9a-f]{31}/) { \
71
+	      print substr($$0, RSTART, RSTART+RLENGTH); \
72
+	    } \
73
+	  '; \
74
+	} \
75
+	| awk '!seen[$$0]++' > $@