Saturday, March 14, 2009

Writing a Compiler with F#

I've been dabbling with F# off and on since it was first publicly available, but I've never put enough time into it for it to feel natural to me.  The language itself has also evolved considerably since the early days.

To take my knowledge of the F# from its current state (simple snippets typed into FSI used to befuddle and amaze people who have never seen a functional language with strong type inference before) into a solid working understanding I'm going to write a compiler for a new programming language.  Languages like F# excel at solving problems like this, so this should give me a good exposure to what it's really like.

I also have some ideas regarding programming languages that I want to try out, but I'll talk more about those as they arise.  I'm going to start pretty simply for the target language and as time goes by I'll hopefully transition from worrying about the low level stuff like F# syntax into the really interesting stuff like the type system for my language and how it interoperates with the CLR.

My intent is to make a series of posts highlighting the process I'm going through including interesting things about F#, compilers and compiling, and type systems.  I'm not getting any Big Ideas about the resulting language - my formal PL background is limited to a solid CS education, reading Pierce's Types and Programming Languages, and lurking Lambda The Ultimate.  That is to say, I'm expecting to do things...less than optimally.

Now since I've posted this introduction I actually have to work on this thing.  Next time I'll talk about some basics of F# and also compilers.

No comments: