Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I accidentally built a kind-of compiler last year.

It started as a few sed commands to merge TeX+code -> TeX for a book project. I ran these sed commands from a makefile. Life was easy.

But then there were complications, and I needed to make slightly more sophisticated substitutions. So the sed commands moved into an awk script, run by the makefile. This was better than maintaining a handful of little commands that were growing on a weekly basis. Life was good.

The transformations I needed kept growing a bunch of little variations, and the awk script became hard to maintain, so I rewrote it in go, with proper parsing and output. (And even unit tests, after the 2nd time I broke some output.) Designing it as almost-a-proper-compiler was 10x better than maintaining an ad hoc script. Life was great, even with the overhead of maintaining a separate processing tool.



Knuth wanted to write a book, so he spent years writing a typesetting system.

Both the book and the system were heroically good.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: