In this tutorial, we’ll look under the cover of the F# compiler. We’ll explore how editors and tools can call the F# compiler API to parse and type check F# code. This might be useful if you want to integrate F# in your favorite editor or if you want to write service F# snippets http://www.fssnip.net/
We’ll also talk about the key components of the F# compiler and how you would go about extending the F# language itself. Don will give you a developer overview of the compiler and Tomas talk about extending the F# computation syntax with experimental extensions like joinads http://http://www.tryjoinads.org/
3. Why Know The Compiler?
#9 For fun
#8 To help maintain the language on multiple platforms
#7 To implement new F# optimizations
#6 To bring F# to new target platforms
#5 To improve free F# editing tools
#4 To write language-aware tools
#3 To embed the language in applications
#2 To implement new interactive coding experiences
#1 To write a compiler API that helps others do the
above
4. What is possible
Visual Studio Extensions
F# Depth Colorizer, Fantomas, F# Regions
MonoDevelop & Emacs & vim
Language Service, F# Refactor
Documentation Tools
FSharp.Formatting & http://fssnip.net
And much more at Tsunami.io
6. Referenced assemblies
FSharp.Compiler.Editor.dll
Modified to expose useful types
Used in F# Refactor & MonoDevelop (soon)
FSharp.Interactive.Service.dll
FSI.exe with EvalExpression : string -> obj
More changes in the code. Needs some testing!
Get at http://github.com/tpetricek/fsharp/tree/fs-extend
and see Dave Thomas’ blog http://7sharpnine.com
15. F# Tooling Extensibility
F# Compiler
Exposes: Tokenizer, untyped AST, editor services
Use for: Editor support, plugins
Working with typed AST is future work
F# Interactive
Embed F# in your application!
But careful about StackOverflow exceptions…