Updates to the August 2011 F# 2.0 Compiler Code Drop

As announced at the Microsoft Research 20th Anniversary event in Cambridge UK, we have updated the F# 2.0 compiler source code drop to include changes related to the www.tryfsharp.org web application. The code drop is the compiler2.0Aug2011.1 directory in the F# PowerPack.

These changes allow you to compile the F# compiler as a browser-hosted (Silverlight 4.0) component. This can then be hosted inside a browser application. This is in keeping with our stated aims for the F# compiler source code drop:  a source drop enables the F# community to develop and contribute a range of tools to the F# and Visual Studio ecosystem. These could be UI tools such as code visualizers, or editing tools such as refactorings, or new ways of executing, hosting or interpreting F# code, or new F# editing experiences.

A sample browser application has been included under the "samples" directory, which shows how to use the compiler component to do four things:

  • Host a F#-Interactive-style dynamic compiler which accepts text streams as input and produces a text stream as output. This is technique used by www.tryfsharp.org
  • Compile a script to an assembly and save it to IsolatedStorage
  • Compile a script to an assembly and produce a dynamic DLL (which is then either executed or inspected using reflection from within the browser application, including extracting ReflectedDefinition quotations from the assembly)
  • Inspect the tokenization, quick info and other intellisense information for a script

This source code is under the Apache 2.0 license and is published as part of the F# PowerPack codeplex project, which is now also under the Apache 2.0 license. The F# PowerPack includes libraries, tools and the compiler/library source code drops.

Enjoy!

The F# team