Does anyone know of any good papers on the implementation of the F# compiler? I'm trying to generate CIL code for a simple functional language targeting the CLR, but I am struggling with a few aspects.
The differences between functional languages and CIL are making it hard to generate well-typed CIL code. I have solutions that work via type erasure, but I'd much rather find a way to generate CIL code that reflects (to at least some extend) the Hindley-Milner type system of my source language (e.g., by generating generic classes). Judging by the generated code from the MS and Mono F# compilers, they manage to achieve exactly this!
There aren't many academic papers on the implementation on F# - although the compiler is open-source, so you can explore the source code if you want to learn about some specific details. (BTW: the F# compiler available in Mono is based on the open-source release, so it is essentially the same as the F# compiler available in Visual Studio).
The only relevant academic publication is Don Syme's paper ILX: Extending the .NET Common IL for Functional Language Interoperability. It is quite interesting reading - it discusses how the IL could be extended to make compilation of functional languages easier. Under the cover, the initial versions of F# compiler compiled to this extended IL (ILX), which is then translated to ordinary IL. The details have probably changed since then, but the core principles will be the same.