F# compiler guide
Welcome to the F# compiler and tools repository! This guide discusses the F# compiler source code and implementation from a technical point of view.
Documentation Topics
- Overview
- Coding Standards
- Compiler Startup Performance
- Debug Emit
- Diagnostics
- Notes on FSharp.Core
- F# Interactive Code Emit
- Large inputs and stack overflows
- Memory usage
- Optimizations
- Equality optimizations
- Project builds
- Tooling features
Edit the source for these docs. The docs are published automatically daily fsharp.github.io/fsharp-compiler-docs/ by this repo.
Key Folders
src/Compiler/Utilities - various utilities, largely independent of the compiler
src/Compiler/Facilities - various items of functionality specific to the compiler
src/Compiler/AbstractIL - the Abstract IL library used for .NET IL
src/Compiler/SyntaxTree - the SyntaxTree, parsing and lexing
src/Compiler/TypedTree - the TypedTree, and utilities associated with it
src/Compiler/Checking - checking logic
src/Compiler/Optimize - optimization and "lowering" logic
src/Compiler/CodeGen - IL code generation logic
src/Compiler/Driver - compiler options, diagnostics and other coordinating functionality
src/Compiler/Symbols - symbols in the public API to the compiler
src/Compiler/Service - the incremental compilation and build logic, plus editor services in the public API to the compiler
src/Compiler/Interactive - the components forming the interactive REPL and core of the notebook engine
src/FSharp.Core - the core library
tests - the tests
vsintegration - the Visual Studio integration
Resources for learning
Video: Learn me some F# Compiler, an online chat with Vlad and Don
Video: Understanding the F# Optimizer, and online chat with Vlad and Don
Video: Resumable State Machines, an online chat with Vlad and Don
Video: FSharp.Compiler.Service, an online chat with Vlad and Don
Tools to help work with the compiler
sharplab.io can be used to decompile code.
fantomas-tools can be used to view the Untyped Abstract Syntax Tree.
Attribution
This document is based on an original document published in 2015 by the F# Software Foundation. It has since been updated substantially.