Fabulous.AST 0.8.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Fabulous.AST --version 0.8.1
                    
NuGet\Install-Package Fabulous.AST -Version 0.8.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fabulous.AST" Version="0.8.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fabulous.AST" Version="0.8.1" />
                    
Directory.Packages.props
<PackageReference Include="Fabulous.AST" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Fabulous.AST --version 0.8.1
                    
#r "nuget: Fabulous.AST, 0.8.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Fabulous.AST@0.8.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Fabulous.AST&version=0.8.1
                    
Install as a Cake Addin
#tool nuget:?package=Fabulous.AST&version=0.8.1
                    
Install as a Cake Tool

Fabulous.AST

build NuGet version NuGet downloads

Welcome to the Fabulous.AST, an Abstract Syntax Tree (AST) Domain Specific Language (DSL) for F#.

Fabulous.AST uses Fantomas to generate F# code from AST. This means that you can use Fabulous.AST to generate F# code that is formatted according to the Fantomas style guide. It's designed to provide a simple and expressive way to represent code as a tree of nodes. This makes it easier to manipulate and analyze code programmatically.

Let's take a look at an AST example in Fantomas:

open Fantomas.Core
open Fantomas.Core.SyntaxOak
open Fantomas.FCS.Text
Oak(
    [],
    [ ModuleOrNamespaceNode(
          None,
          [ BindingNode(
                None,
                None,
                MultipleTextsNode([ SingleTextNode("let", Range.Zero) ], Range.Zero),
                false,
                None,
                None,
                Choice1Of2(IdentListNode([ IdentifierOrDot.Ident(SingleTextNode("x", Range.Zero)) ], Range.Zero)),
                None,
                [],
                None,
                SingleTextNode("=", Range.Zero),
                Expr.Constant(Constant.FromText(SingleTextNode("12", Range.Zero))),
                Range.Zero
            )
            |> ModuleDecl.TopLevelBinding ],
          Range.Zero
      ) ],
    Range.Zero
)
|> CodeFormatter.FormatOakAsync
|> Async.RunSynchronously
|> printfn "%s"

produces the following code:

let x = 12

Now let's take a look at same example using Fabulous.AST:

open Fantomas.Core
open type Fabulous.AST.Ast

AnonymousModule() { 
    Value("x", "12", false)
}
|> Gen.mkOak
|> CodeFormatter.FormatOakAsync
|> Async.RunSynchronously
|> printfn "%s"

produces the following code:

let x = 12
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Fabulous.AST:

Package Downloads
MigLib

Package Description

MigrateLib

Declarative migrations for SQLite

Fabulous.AST.Json

Fabulous.AST.Json, a JSON type generator for Fabulous.AST

FSharp.Grpc.Tools

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0-pre06 1,717 1/9/2026
2.0.0-pre05 249 12/19/2025
2.0.0-pre04 272 12/15/2025
2.0.0-pre03 189 12/13/2025
2.0.0-pre02 139 12/12/2025
2.0.0-pre01 146 12/12/2025
1.10.0 1,414 1/9/2026
1.9.0 1,019 12/12/2025
1.8.0 171 12/6/2025
1.7.0 691 12/3/2025
1.6.0 647 6/7/2025
1.5.0 205 5/10/2025
1.4.0 303 4/4/2025
1.3.0 276 3/16/2025
1.2.0 546 3/5/2025
1.1.0 241 1/12/2025
1.0.0 250 12/15/2024
1.0.0-pre17 195 10/6/2024
1.0.0-pre16 225 7/14/2024
0.8.1 257 3/10/2024
Loading failed

### Added
- Escape content in from String by @edgarfgp in https://github.com/edgarfgp/Fabulous.AST/pull/64