Browse code

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

Robert Cranston authored on 20/04/2026 04:10:52
Showing 1 changed files
... ...
@@ -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]++' > $@
Browse code

Add initial Universal Machine emulator

Robert Cranston authored on 19/04/2026 22:10:36
Showing 1 changed files
... ...
@@ -1,7 +1,9 @@
1 1
 .POSIX:
2 2
 
3 3
 .PHONY: all
4
-all:
4
+all: um
5
+
6
+.PHONY: test
5 7
 
6 8
 # Remove `.gitignore`d files interactively.
7 9
 .PHONY: clean
... ...
@@ -34,3 +36,11 @@ sandmark-output.txt um.um:
34 36
 	curl -sSL $(URL)/$@ > $@
35 37
 um-spec.txt:
36 38
 	curl -sSL $(URL)/$@ | awk 'sub(/ *$$/, "") || 1;' > $@
39
+
40
+um: um.cpp
41
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) um.cpp $(LDLIBS) -o $@
42
+
43
+test: um sandmark.umz sandmark-output.txt
44
+	{ time ./um sandmark.umz; } \
45
+	| tee /dev/tty \
46
+	| diff -q sandmark-output.txt -
Browse code

Archive given files

Robert Cranston authored on 09/05/2025 21:51:04
Showing 1 changed files
... ...
@@ -7,3 +7,30 @@ all:
7 7
 .PHONY: clean
8 8
 clean:
9 9
 	git clean -Xi
10
+
11
+URL = http://boundvariable.org
12
+task.txt:
13
+	curl -sSL $(URL)/task.shtml \
14
+	| pandoc --from html --to plain --columns=79 \
15
+	| awk ' \
16
+	  /^An Urgent Appeal$$/           { body = 1;      } \
17
+	  /^Carnegie Mellon University$$/ { print; exit;   } \
18
+	  /^[[:punct:]]+$$/               { getline; next; } \
19
+	  body; \
20
+	' > $@
21
+sha1sums.txt:
22
+	curl -sSL $(URL)/task.shtml \
23
+	| pandoc --from html --to plain --columns=79 \
24
+	| awk ' \
25
+	  $$1 == "[]"    { file = $$2; } \
26
+	  $$1 == "SHA-1" { print $$3, "*" file; } \
27
+	' > $@
28
+codex-key.txt: task.txt
29
+	awk 'key { print; exit; } /decryption key/ { key = 1; }' task.txt > $@
30
+codex.umz sandmark.umz: sha1sums.txt
31
+	curl -sSL $(URL)/$@ > $@
32
+	awk '$$2 == "*$@"' sha1sums.txt | sha1sum -c
33
+sandmark-output.txt um.um:
34
+	curl -sSL $(URL)/$@ > $@
35
+um-spec.txt:
36
+	curl -sSL $(URL)/$@ | awk 'sub(/ *$$/, "") || 1;' > $@
Browse code

Add Makefile

Robert Cranston authored on 22/11/2024 01:44:30
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,9 @@
1
+.POSIX:
2
+
3
+.PHONY: all
4
+all:
5
+
6
+# Remove `.gitignore`d files interactively.
7
+.PHONY: clean
8
+clean:
9
+	git clean -Xi