Farkle.Tools.MSBuild
7.0.1
dotnet add package Farkle.Tools.MSBuild --version 7.0.1
NuGet\Install-Package Farkle.Tools.MSBuild -Version 7.0.1
<PackageReference Include="Farkle.Tools.MSBuild" Version="7.0.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Farkle.Tools.MSBuild" Version="7.0.1" />
<PackageReference Include="Farkle.Tools.MSBuild"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Farkle.Tools.MSBuild --version 7.0.1
#r "nuget: Farkle.Tools.MSBuild, 7.0.1"
#:package Farkle.Tools.MSBuild@7.0.1
#addin nuget:?package=Farkle.Tools.MSBuild&version=7.0.1
#tool nuget:?package=Farkle.Tools.MSBuild&version=7.0.1
Farkle.Tools.MSBuild
This package provides integration with MSBuild for the Farkle parser library.
Precompiling grammars
The main feature of this integration is the ability to precompile grammars at build time. This offers multiple benefits, including better startup performance and compile-time grammar validation.
C#
using Farkle;
using Farkle.Builder;
var parser = GetParser();
var result = parser.Parse("1 + 2"); // Whitespace is ignored by default.
Console.WriteLine(result); // 3
[PrecompilerInput]
static IGrammarBuilder<int> GetGrammar()
{
var number = Terminals.Int32("Number");
return Nonterminal.Create("Addition",
number.Extended().Append("+").Extend(number).Finish((left, right) => left + right)
);
}
[PrecompilerOutput]
static CharParser<int> GetParser() => CharParser.MustPrecompile<int>();
F#
open Farkle
open Farkle.Builder
[<PrecompilerInput>]
let getGrammar() =
let number = Terminals.Int32("Number")
"Addition" ||= [
!@ number .>> "+" .>>. number => (fun left right -> left + right)
]
[<PrecompilerOutput>]
let getParser() = CharParser.mustPrecompile<int>
let parser = getParser()
let result = CharParser.parseString parser "1 + 2" // Whitespace is ignored by default.
printfn "%O" result // 3
Generating HTML documentation
You can generate HTML documentation for your precompiled grammars by enabling the FarkleGenerateHtml property in your project:
<PropertyGroup>
<FarkleGenerateHtml>true</FarkleGenerateHtml>
</PropertyGroup>
Documentation
Learn more about Target Frameworks and .NET Standard.
-
- Sigourney.Build (>= 0.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 7.0.1 | 147 | 7/9/2026 |
| 7.0.0 | 124 | 6/28/2026 |
| 7.0.0-preview.3 | 71 | 5/18/2026 |
| 7.0.0-preview.2 | 486 | 10/30/2025 |
| 7.0.0-preview.1 | 489 | 9/6/2025 |
| 6.5.2 | 27,925 | 11/10/2024 |
| 6.5.1 | 27,867 | 1/25/2023 |
| 6.5.0 | 589 | 9/8/2022 |
| 6.4.0 | 709 | 3/11/2022 |
| 6.3.2 | 606 | 10/31/2021 |
| 6.3.1 | 558 | 10/18/2021 |
| 6.3.0 | 636 | 10/3/2021 |
| 6.2.0 | 599 | 5/16/2021 |
| 6.1.0 | 573 | 3/4/2021 |
| 6.0.0 | 612 | 2/22/2021 |
| 6.0.0-alpha.3 | 424 | 11/25/2020 |
| 6.0.0-alpha.2 | 491 | 8/22/2020 |
| 6.0.0-alpha.1 | 504 | 4/13/2020 |
| 5.4.1 | 909 | 3/23/2020 |
| 5.4.0 | 768 | 3/20/2020 |
You can see information about the latest releases on https://github.com/teo-tsirpanis/Farkle/releases