How to get started with a new backend?

Jason Dagit dagitj at
Mon Jan 28 02:15:37 CET 2013

I would like to explore making a backend for .NET. I've done a lot of
background reading about previous .NET and JVM attempts for Haskell. It
seems like several folks have made significant progress in the past and,
with the exception of UHC, I can't find any code around the internet from
the previous efforts. I realize that in total it's a huge undertaking and
codegen is only one of several significant hurdles to success.

I would like to get a very, very, very simple translation working inside
GHC. If all I can compile and run is fibonacci, then I would be quite
happy. For my first attempt, proof of concept is sufficient.

I found a lot of good documentation on the ghc trac for how the compilation
phases work and what happens in the different parts of the backend. The
documentation is excellent, especially compared to other compilers I've
looked at.

When I started looking at how to write the code, I started to wonder about
the "least effort" path to getting something (anything?) working. Here are
some questions:
  * Haskell.NET seems to be dead. Does anyone know where their code went?
  * Did lambdavm also disappear? (JVM I know, but close enough to be useful)
  * Would it make sense to copy&modify the -fvia-C backend to generate C#?
The trac claims that ghc can compile itself to C so that only standard gnu
C tools are needed to build an unregistered compiler. Could I use this
trick to translate programs to C#?
  * What stage in the pipeline should I translate from? Core? STG? Cmm?
  * Which directories/source files should I look at to get familiar with
the code gen? I've heard the LLVM codegen is relatively simple.
  * Any other advice?

Thank you in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Glasgow-haskell-users mailing list