FSharp.Quotations.Compiler


FSharp.Quotations.Compiler

The FSharp.Quotations.Compiler library can be installed from NuGet:
PM> Install-Package FSharp.Quotations.Compiler

Summary

FSharp.Quotations.Compiler is a library for compiling F# expression tree to IL.

There are similar libraries:

The biggest difference between FSharp.Quotations.Compiler and these is analysis policy of expression tree. FSharp.Quotations.Compiler uses while loop rather than recursive function. So we can use this library without thinking about stack overflow.

Example

1: 
2: 
#r "FSharp.Quotations.Compiler.dll"
open FSharp.Quotations.Compiler
1: 
2: 
3: 
let expr = <@ 10 + 20 @>
let res = expr.Compile()
printfn "%d" (res.ExecuteCompiledCode())

The output is:

30

Samples & documentation

  • Tutorial contains a further explanation of this library.
  • Limitations contains an explanation of limitations of this library.
  • API Reference contains automatically generated documentation for all types, modules and functions in the library.

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests.

The library is available under Public Domain license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.

namespace FSharp
namespace FSharp.Quotations
namespace FSharp.Quotations.Compiler
val expr : Quotations.Expr<int>

Full name: Index.expr
val res : ICompiledCode<int>

Full name: Index.res
member Quotations.Expr.Compile : unit -> ICompiledCode<'T>
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
abstract member ICompiledCode.ExecuteCompiledCode : unit -> 'T
Fork me on GitHub