What is the best language to write a compiler in (not for)?
The one with the best libraries for supporting that sort of task. In this case, probably C/C++, but I would look at the following for doing such things:
I would also note that your answer would depend on the environment/platform you are targeting. When targeting the Java platform using bytecode, the tools might take a different tack. When using the CLR/.NET, your answer will differ there as well.
I like the answer of using your own language, perhaps read about bootstrapping before doing so.
Many compilers are written in C or ML type languages. Which one is the best is subjective.
It depends on what language you're targeting. Microsoft makes it much easier to write a compiler targeting .NET using .NET itself (C#) as seen here. There are also books specifically for .NET language design. If you are targeting a compiled language like C though, it is usually a popular choice to write the compiler in C itself, and the lower level bits in assembler. This article called "Lets build a compiler" may be of interest to you, it covers compiler theory using the Pascal language although the ideas expressed are easily convertible to any language.
If the language you're designing is sufficiently capable, then building the compiler in its own language is a fantastic choice. There's nothing quite like ensuring your language is completely robust than working with it every day to solve a complex problem.
C compilers are typically written in C; C++ compilers are written in C++, the C# compiler is written in C#, and the list goes on from there.
I would say to use the language of which you are most familiar. If your grammar is small you can probably hand code it in any language, I build a small graphics processing language in Delphi by hand becuase the language was simple and the toolset we were using was built around delphi.
If I was builidng a larger language system, lexer/parser, code generator, linker/loader etc. I would probably use C becuase of the library support for those types of activities and the executiong speed means source text cna be processed pretty quickly. However, with enough determination you could do this with C#, java, python or ruby if you understand the concepts of building a compiler/translator.
Building compilers is essentially rewriting trees. This is the killer app for the ML family of languages (Standard ML and Objective Caml and, to a lesser extent, Haskell. (Note: I love Haskell, but if all the questioner wants to do is write a compiler, I think ML is easier for beginners because the time and space behavior of the compiler is much more predictable, and it is possible to build the compiler without having to grok the IO monad, type classes, and other advanced ideas.)
Professor Zhong Shao of Yale University reported that when he changed Yale's compiler class to use Standard ML (from C I believe), the class was able to complete a full compiler, which normally took a semester, before Thanksgiving, leaving the rest of the term for advanced topics.
After Dave Hanson published his superb book with Chris Fraser on engineering lcc, I asked him what he and Chris had learned after spending ten years carefully designing and implementing lcc. His response:
C is a lousy language to write a compiler in.
I personally have written compilers in both Standard ML and Objective Caml. I have worked extensively on other people's compilers written in C, Haskell, Modula-3, and Standard ML. While today I have over 20 years of experience and am very happy programming in Haskell, for your first compiler I recommend Standard ML. Objective Caml is also a very good choice. The two languages grow from similar roots, and you can read about the differences on Stackoverflow.
This is probably not what others will suggest, but you might want to check out the Parrot virtual machine and its Parrot Compiler Toolkit for languages targeting it. There are already implementations of several languages using Parrot as their runtime/compiler, including APL, JavaScript, Python, Scheme, Perl 1, and (the reason Parrot was started in the first place) Perl 6. It's cross-platform, too - several of the developers are on Windows, Linux, the various BSDs, etc.
Links:
I second the ML idea. I like F# (available on Mono or .NET) as an ML variant that gives you lots of good framework support. For a parser, I've been a fan of http://www.antlr.org/. If the language you're writing is relatively general purpose, writing a compiler in it is a good exercise in making sure your compiler is full featured and bug-free. But of course if you're writing a language meant to do something very different, you're barking up the wrong tree.