Re:Ask HN: How was your Advent of Code 2018 experience?
by Zedronar on Tuesday December 25, 2018 @06:13AM
(#18756988)
Is there any particular technical reason behind the decision of having 4500 LoC in a single file? It sounds like a pain to maintain and extend.
Re:Ask HN: How was your Advent of Code 2018 experience?
by ahaferburg on Tuesday December 25, 2018 @06:41AM
(#18757049)
I wanted to always compile everything, and I don't have modules yet. Every problem is in one function, so for AOC it wasn't a problem.
Re:Ask HN: How was your Advent of Code 2018 experience?
by tomsmeding on Tuesday December 25, 2018 @08:23AM
(#18757304)
That sounds awesome! Do you have any published code for your compiler/language yet? I'm curious :)
Re:Ask HN: How was your Advent of Code 2018 experience?
by ahaferburg on Wednesday December 26, 2018 @04:24AM
(#18761386)
Thanks! Sorry, I haven't published anything. My inspirations are Jai, Zig, Ante, and Odin, if that helps.
On day 6 I got a stack overflow, so I had to quickly implement new/delete. For the Elf processor I had to add in binary operators. Design-wise it taught me that good literals can be really helpful, e. g. an initializer expression for an array of structs. With Python's dict/tuple/array literals e. g. you could sometimes replace parsing entirely with a couple text transformations in Sublime. Maybe this is specific to these kinds of problems, but I think it would also be helpful for unit tests.
It was fun to learn a new algorithm (A*) and implement it. Day 23 part 2 was my favorite. I was stuck for hours, tried two solutions that didn't work out. Went to bed frustrated, then implemented the solution the next morning. I'm still thinking about it, it's an interesting problem.