From 6c7336937b4ccb0c72b54035d4f1ee16761f040d Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Fri, 18 Dec 2020 00:53:14 -0500 Subject: 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 --- 2020/day18-2.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 2020/day18-2.sh (limited to '2020') 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 -- cgit 1.4.1