summary refs log tree commit diff homepage
path: root/2020
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-18 00:53:14 -0500
committerJune McEnroe <june@causal.agency>2020-12-18 00:53:14 -0500
commit6c7336937b4ccb0c72b54035d4f1ee16761f040d (patch)
tree610a7aca387a489bdb63c6afa9b1580ac8adc2fc /2020
parentSolve day 18 part 1 (diff)
downloadaoc-6c7336937b4ccb0c72b54035d4f1ee16761f040d.tar.gz
aoc-6c7336937b4ccb0c72b54035d4f1ee16761f040d.zip
Solve day 18 part 2
Is it cheating to implement the FORTRAN I approach[1] as preprocessing?
Maybe.

[1]: https://en.wikipedia.org/wiki/Operator-precedence_parser#Alternative_methods
Diffstat (limited to '2020')
-rw-r--r--2020/day18-2.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/2020/day18-2.sh b/2020/day18-2.sh
new file mode 100644
index 0000000..1f49446
--- /dev/null
+++ b/2020/day18-2.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+sed '
+s/(/&((/g
+s/)/))&/g
+s/*/))*((/g
+s/+/)+(/g
+s/^/((/
+s/$/))/
+' | ./day18