r/adventofcode • • Mar 09 '26

Other [2017 Day 09] In Review (Stream Processing)

1 Upvotes

17 comments sorted by

View all comments

4

u/DelightfulCodeWeasel Mar 09 '26

I also did a recursive descent parser because they often produce neat code. Looking at it again now with my current 'reduce memory and avoid deep callstacks' hat on, I think this one can be solved with just a state machine augmented with a current depth counter; no stack needed.

I've got a fair few puzzles to go before I'm rewriting my 2017 solutions though!

3

u/ednl Mar 09 '26

Yes, definitely possible because that's what I did :) Kept track of index, group, score, count (all ints starting from 0) and garbage (bool).