The hardest thing I ever wrote was an inliner for a language I made myself.
You'd think it is a simple problem, but soon you will have a rabid animal on a leash and you will be struggling to restrain it.
I gave the source to a friend who modified it a bit and commited it to a language that was mentioned a couple of times on HN in the early days. It has since been replaced, but was used for a good 5 years.