Fabulous.AST
1.6.0
dotnet add package Fabulous.AST --version 1.6.0
NuGet\Install-Package Fabulous.AST -Version 1.6.0
<PackageReference Include="Fabulous.AST" Version="1.6.0" />
<PackageVersion Include="Fabulous.AST" Version="1.6.0" />
<PackageReference Include="Fabulous.AST" />
paket add Fabulous.AST --version 1.6.0
#r "nuget: Fabulous.AST, 1.6.0"
#:package Fabulous.AST@1.6.0
#addin nuget:?package=Fabulous.AST&version=1.6.0
#tool nuget:?package=Fabulous.AST&version=1.6.0
Fabulous.AST
Welcome to Fabulous.AST, an Abstract Syntax Tree (AST) Domain Specific Language (DSL) for F#.
Fabulous.AST leverages Fantomas to generate F# code from AST. This allows you to create F# code that adheres to the Fantomas style guide while providing a simple and expressive way to represent code as a tree of nodes. This approach simplifies programmatic code manipulation and analysis.
Features
- Simplified AST creation for F# code
- Integration with Fantomas for consistent code formatting
- Expressive DSL for representing code structures
- Easy-to-use API for code generation and manipulation
Installation
Install Fabulous.AST via NuGet:
dotnet add package Fabulous.AST
Usage
Let's compare AST creation using Fantomas directly and Fabulous.AST:
Fantomas AST Example
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"
Fabulous.AST Example
open Fantomas.Core
open Fabulous.AST
open type Fabulous.AST.Ast
Oak() {
AnonymousModule() {
Value("x", "12")
}
}
|> Gen.mkOak
|> Gen.run
Both examples produce the following F# code:
let x = 12
As you can see, Fabulous.AST significantly simplifies the process of creating ASTs for F# code.
Documentation
For comprehensive information about Fabulous.AST, visit our documentation site.
Additional resources:
Supporting Fabulous.AST
Show your support for Fabulous.AST:
- Star this repository and the Fabulous.AST project on GitHub.
- Become a sponsor through the GitHub Sponsors program.
Contributing
We welcome contributions to Fabulous.AST!
- Found a bug or have a suggestion? Open an issue, and we'll look into it promptly.
- Want to contribute code? PRs are always welcome! Please create them from the
mainbranch and follow our Contributor Guide.
License
Fabulous.AST is released under the MIT License.
| Product | Versions 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. |
-
.NETStandard 2.1
- Fantomas.Core (= 7.0.1)
-
net8.0
- Fantomas.Core (= 7.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Fabulous.AST:
| Package | Downloads |
|---|---|
|
MigrateLib
Declarative migrations for SQLite |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.6.0 | 360 | 6/7/2025 |
| 1.5.0 | 158 | 5/10/2025 |
| 1.4.0 | 252 | 4/4/2025 |
| 1.3.0 | 225 | 3/16/2025 |
| 1.2.0 | 403 | 3/5/2025 |
| 1.1.0 | 188 | 1/12/2025 |
| 1.0.0 | 196 | 12/15/2024 |
| 1.0.0-pre9 | 248 | 5/13/2024 |
| 1.0.0-pre8 | 168 | 5/12/2024 |
| 1.0.0-pre7 | 189 | 5/10/2024 |
| 1.0.0-pre6 | 182 | 5/10/2024 |
| 1.0.0-pre5 | 217 | 4/14/2024 |
| 1.0.0-pre4 | 167 | 4/7/2024 |
| 1.0.0-pre3 | 187 | 4/1/2024 |
| 1.0.0-pre2 | 189 | 3/27/2024 |
| 1.0.0-pre17 | 144 | 10/6/2024 |
| 1.0.0-pre16 | 186 | 7/14/2024 |
| 1.0.0-pre15 | 187 | 7/1/2024 |
| 1.0.0-pre14 | 154 | 6/13/2024 |
| 1.0.0-pre13 | 167 | 6/2/2024 |
| 1.0.0-pre12 | 385 | 5/20/2024 |
| 1.0.0-pre11 | 181 | 5/16/2024 |
| 1.0.0-pre10 | 171 | 5/13/2024 |
| 1.0.0-pre1 | 182 | 3/25/2024 |
| 0.9.0 | 246 | 3/12/2024 |
| 0.8.2 | 215 | 3/11/2024 |
| 0.8.1 | 202 | 3/10/2024 |
| 0.8.0 | 218 | 3/8/2024 |
| 0.7.0 | 483 | 2/11/2024 |
| 0.6.2 | 344 | 6/8/2023 |
| 0.6.1 | 306 | 6/4/2023 |
| 0.6.0 | 287 | 5/29/2023 |
| 0.5.0 | 324 | 4/21/2023 |
| 0.4.0 | 346 | 4/13/2023 |
| 0.3.0 | 330 | 4/11/2023 |
| 0.2.0 | 313 | 4/6/2023 |
| 0.1.0 | 344 | 4/3/2023 |
### Changed
- Expose the APIs using instead of by @edgarfgp in https://github.com/edgarfgp/Fabulous.AST/pull/151