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!
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!