FastParser 0.1.2

dotnet add package FastParser --version 0.1.2
                    
NuGet\Install-Package FastParser -Version 0.1.2
                    
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="FastParser" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FastParser" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="FastParser" />
                    
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 FastParser --version 0.1.2
                    
#r "nuget: FastParser, 0.1.2"
                    
#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 FastParser@0.1.2
                    
#: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=FastParser&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=FastParser&version=0.1.2
                    
Install as a Cake Tool

FastParser for .NET

NuGet Release CI License

FastParser is a thin C# binding over the FastParse native C ABI.

It parses source bytes in memory and returns AST data as JSON, CSV, binary MessagePack, or stats. It can also execute Tree-sitter queries and return structural matches/captures. The current native package includes the Java Tree-sitter grammar.

Install

dotnet add package FastParser --version 0.1.0-preview.17

The package includes RID-specific native libraries:

runtimes/linux-x64/native/libfastparse.so
runtimes/osx-arm64/native/libfastparse.dylib
runtimes/osx-x64/native/libfastparse.dylib
runtimes/win-x64/native/fastparse.dll

Basic Use

using FastParse;

using var parser = new FastParseClient();

var result = parser.ParseText(
    "class Demo { void run() {} }",
    new ParseOptions
    {
        Format = FastParseFormat.Json,
        IncludeRules = "method_declaration",
        Fields = FastParseField.Rule |
                 FastParseField.Text |
                 FastParseField.ByteRange
    });

Console.WriteLine(result.NodeCount);
Console.WriteLine(result.Text);

Tree-sitter Queries

Use QueryText when the grammar pattern is already known and the caller only needs specific captures:

var queryResult = parser.QueryText(
    "class Demo { void run() {} }",
    "(method_declaration name: (identifier) @method.name) @method",
    new QueryOptions
    {
        Language = "java",
        Format = FastParseFormat.Json,
        Fields = FastParseField.CaptureName |
                 FastParseField.Rule |
                 FastParseField.Text |
                 FastParseField.Range |
                 FastParseField.ByteRange
    });

Console.WriteLine(queryResult.Text);

For query stats, ParseSummary.NodeCount is the capture count and ParseSummary.OutputLength is the match count.

Binary Output

For FastParseFormat.Binary, ParseResult.Data contains MessagePack bytes. The package includes a small schema-specific decoder:

var binary = parser.ParseText(source, new ParseOptions
{
    Format = FastParseFormat.Binary,
    IncludeRules = "method_declaration",
    Fields = FastParseField.Rule | FastParseField.Text | FastParseField.ByteRange
});

var document = FastParseMessagePack.Decode(binary.Data);
Console.WriteLine(document.SchemaVersion);
Console.WriteLine(document.Nodes[0].Rule);

Diagnostics

Request FastParseField.Diagnostics to see Tree-sitter recovery signals:

var binary = parser.ParseText(source, new ParseOptions
{
    Format = FastParseFormat.Binary,
    Fields = FastParseField.Rule | FastParseField.Diagnostics
});

var document = FastParseMessagePack.Decode(binary.Data);
Console.WriteLine(document.HasErrors);
Console.WriteLine(document.ErrorNodeCount);
Console.WriteLine(document.Nodes[0].HasError);

Diagnostics are normal output data. A parse can succeed while HasErrors is true.

Stats Without Output Copy

var summary = parser.ParseTextSummary(source, new ParseOptions
{
    Format = FastParseFormat.Stats
});

Console.WriteLine(summary.NodeCount);
Console.WriteLine(summary.OutputLength); // 0 for stats

Native Library Loading

Normal NuGet use does not require FASTPARSE_LIBRARY_PATH; .NET resolves the bundled native asset for the current RID.

For advanced/manual loading, pass a path explicitly:

using var parser = new FastParseClient("/path/to/libfastparse.dylib");

Or set:

FASTPARSE_LIBRARY_PATH=/path/to/libfastparse.dylib

Threading

Use one FastParseClient per worker thread for simple high-throughput code. Parent applications still own thread pools, queues, and database coordination.

Package Name vs Namespace

The public NuGet package ID is FastParser.

The C# namespace is FastParse:

using FastParse;

Included Agent Resources

The NuGet package includes integration docs and examples for humans and AI agents:

AI_AGENT_GUIDE.md
docs/contracts.md
docs/language_extensions.md
docs/output_formats.md
docs/tree_sitter_queries.md
docs/binary_schema.md
docs/csharp_binding.md
docs/encoding.md
docs/platforms.md
docs/versioning.md
examples/csharp/01_parse_string/
examples/csharp/02_binary_decode/
examples/csharp/nuget/01_parse_string/
examples/csharp/nuget/02_binary_decode/

Start with AI_AGENT_GUIDE.md when generating an integration with an AI coding agent.

Debugging

The NuGet release includes portable PDBs, SourceLink metadata, XML documentation, and a .snupkg symbols package. Debuggers that support NuGet symbols can step from the package into the matching GitHub source revision.

Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on FastParser:

Package Downloads
FastParser.Language.Python

FastParse python language extension native assets.

FastParser.Language.JavaFrameworks

FastParse java-frameworks language extension native assets.

FastParser.Language.Cobol

FastParse cobol language extension native assets.

FastParser.Language.JavaSwing

FastParse javaswing language extension native assets.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 156 8/24/2026
0.1.1 146 8/21/2026
0.1.1-preview.1 97 8/21/2026
0.1.0 204 6/30/2026
0.1.0-preview.37 95 8/13/2026
0.1.0-preview.36 82 8/13/2026
0.1.0-preview.35 102 8/13/2026
0.1.0-preview.34 87 8/13/2026
0.1.0-preview.33 89 8/13/2026
0.1.0-preview.32 92 6/30/2026
0.1.0-preview.31 73 6/30/2026
0.1.0-preview.30 83 6/30/2026
0.1.0-preview.29 74 6/30/2026
0.1.0-preview.28 72 6/30/2026
0.1.0-preview.27 71 6/30/2026
0.1.0-preview.26 71 6/30/2026
0.1.0-preview.23 78 6/29/2026
0.1.0-preview.22 81 6/29/2026
0.1.0-preview.21 76 6/29/2026
0.1.0-preview.20 89 6/29/2026
Loading failed

Stable package with bundled native libraries, JSON/CSV/binary/stats/diagnostics outputs, SourceLink, C# XML documentation, and COBOL legacy normalization support.