AoC Day 11: Monkey in the Middle - this framework made parsing it so simple! 🤩 #268
oliverfoggin
started this conversation in
Show and tell
Replies: 2 comments 1 reply
-
Small tip - you don’t need the skip around the string literal parsers as these are void parsers anyway. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Really awesome @oliverfoggin. Exciting to see how simple that parser turned out to be! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been using swift-parsing for this year's AoC and it has been an excellent learning tool.
Until I came to this problem... https://adventofcode.com/2022/day/11
Which has an input like this...
I was a bit apprehensive when I first saw this because this is the kind of input that is really hard to parse.
And I am not exaggerating when I say that swift-parsing made this trivial.
I worked through the parser and added types and properties as and when they were needed and it literally worked first time. 🤯
Anyway, up to then it was on a par with just raw parsing. In fact... I had done everything without using swift-parsing up to Day8. It was with this one that the power of this framework suddenly became apparent.
Anyway... here's my Parser (without any of the logic so no spoilers) but you can almost read through it and see what the input is from the parser. (Also, I'm still learning so this may not be optimal).
Beta Was this translation helpful? Give feedback.
All reactions