XParsec 0.3.0

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

<div align="center"> <h1 align="center"> <img alt="XParsec logo" src="docs/images/logo.svg" title="Logo" align="center"/> XParsec </h1> </div> <br/>

Documentation NuGet Version

XParsec is a parser combinator library for F#

It aims to be a successor to the popular FParsec library with several important differences:

  • Generalization over collection and token types

With XParsec all common contiguous collections string 'T array ResizeArray<'T> ImmutableArray<'T> and ReadOnlyMemory<'T> can be parsed with essentially the same code.

  • Pure F# implementation

F# is a great .NET language but with the Fable compiler, a powerful JavaScript language too. By implementing XParsec completely in F#, I aim to provide an equally robust and easy to use parsing library for Fable target languages.

  • More Performant

By making use of newer F# & .NET technologies like [<InlineIfLambda>] Span<'T> and struct unions I aim to make XParsec competitive with imperative parsing libraries while remaining terse and easy to reason about.

Initial results are encoraging with roughly 2/3 the execution time and 1/5 the allocations for the equivalent parser code parsing a single large json file.

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
XParsecJson 47.00 ms 0.900 ms 0.798 ms 3363.6364 818.1818 272.7273 36.99 MB
FParsecJson 73.77 ms 1.325 ms 1.240 ms 17714.2857 1285.7143 428.5714 208.37 MB
  • Simplified operator precedence parsing
  • No line number tracking by default. A separate line ending parser is available for generating detailed error messages.
The quick brown fox jumps over the lazy dog.
    ^ At index 4 (Ln 1, Col 5)
All choices failed.
├───Expected 'a'
└───All choices failed.
    ├───Unexpected 'q'
    └───Expected 'c'

Running Tests

.NET

dotnet test

Fable JS

npm run test
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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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 (2)

Showing the top 2 NuGet packages that depend on XParsec:

Package Downloads
Partas.Tools.SepochSemver

An opinionated spec extension and parser of Semver with an optional EPOCH and Scope prefix.

Partas.Tools.ConventionalCommits

Conventional Commits v1.0.0 spec commit message parser.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0 63 1/1/2026
0.2.5 571 12/9/2025
0.2.4 294 11/23/2025
0.2.3 177 10/12/2025
0.2.2 277 8/27/2025
0.2.1 1,843 8/4/2025
0.2.0 864 7/3/2025
0.1.0 307 4/20/2025
0.0.3 223 4/6/2025
0.0.2 144 4/5/2025