ParsecSharp 5.0.0

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

ParsecSharp

NuGet

The faster monadic parser combinator library for C#

What's this

This library provides the most useful Text Parsers, Stream Parsers, and Parser Combinators. All APIs are pure, immutable, and can combine with any others. Designed to utilize JIT Compiler optimizations, it realizes complete immutability and can parse infinitely recursive data structures.

This project is inspired by parsec, a monadic parser library for Haskell.

Concept

  • Easy construction APIs with monads in C#
  • Pure/Immutable/Functional framework in C#
  • Replace regular expressions in your code (applicable from smallest to largest)
  • Most readable API source code
  • F12 (Go To Definition) friendly

Overview

  • Strictly typed parsers/combinators that support natural type inference
  • A lot of reasonable built-in parsers/combinators
  • Supports parsing infinitely recursive data structures
  • Supports full backtracking: Parsing Expression Grammar (PEG) style parsing strategy
  • Supports parsing streams of any token type (e.g., string, char stream, binary stream, any enumerable)
  • Supports tokenization
  • Supports partial parsing
  • Supports custom derivation for core types
  • Supports nullable reference types (with C# 8.0 or later)
  • Supports Source Link (that allows to refer to every parser implementation source code)
  • No additional dependencies
  • Faster running
  • Just enough error messages
  • No left-recursion support
  • No packrat parsing support (because it increases parsing time in most cases)

How to install

From NuGet

dotnet-cli:

$ dotnet add package ParsecSharp

NuGet Package Manager Console:

> Install-Package ParsecSharp

PackageReference:

<ItemGroup>
  <PackageReference Include="ParsecSharp" Version="*" />
</ItemGroup>

Download manually:

NuGet gallery

Supported platforms

  • net10.0 (provides full functionality, best performance)
  • netstandard2.1 (provides same functionality as net10.0, compatible with net5.0 or later, mono, unity, and more)
  • netstandard2.0 (works on legacy environments, some runtime features are disabled, compatible with net461 or later, uap, xamarin, and more)

Recommends C# 14.0 or later to enable all library features. If you would like to support legacy environments, recommends creating a netstandard2.0 library project with C# 14.0 and referencing it.

  • Requires C# 7.3 or later: for generic overloading resolution
  • C# 8.0 or later: nullable reference types enabled
  • C# 13.0 or later: overloading resolution improved via OverloadResolutionPriority
  • C# 14.0 or later: extension operators enabled

Note: This library may not work on runtimes with poor optimization capabilities.

Get started

  1. Add the package reference to your project.
  2. Add the using directives: using static ParsecSharp.Parser; and using static ParsecSharp.Text; to your code.
  3. Parse everything.

How to use

Implementation examples

Documentation is available in the UnitTest code.

If you want more information, check out the API source code, it's all there.

Questions?

Feel free to create an Issue!

License

This software is released under the MIT License, see LICENSE.

Using
  • Fody (MIT): Only for internal use; does NOT propagate license acceptance to users.
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 was computed.  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 is compatible.  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 is compatible. 
.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.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ParsecSharp:

Package Downloads
KSPMMCfgParser

Parses .cfg files in combined KSP/MM format

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0 29 1/1/2026
4.1.2 300 7/14/2025
4.1.1 265 6/25/2025
4.0.0 1,937 1/1/2025
3.6.0 272 8/6/2024
3.5.0 11,941 11/24/2022
3.4.0 1,164 3/18/2022
3.3.2 22,538 3/9/2021
3.3.1 905 11/14/2020
3.3.0 676 11/11/2020
3.2.2 795 5/17/2020
3.2.1 798 3/5/2020
3.2.0 772 2/27/2020
3.1.1 838 1/22/2020
3.1.0 815 12/11/2019
3.0.0 802 12/5/2019
2.4.0 854 10/26/2019
2.3.0 832 10/21/2019
2.2.1 825 10/17/2019
2.2.0 817 10/17/2019
2.0.0 811 9/28/2019
1.6.0 923 6/2/2019
1.5.0 883 2/26/2019
1.4.1 1,667 5/1/2018
1.4.0 1,528 4/24/2018
1.3.0 1,582 12/11/2017
1.2.0 1,353 10/25/2017
1.1.0 1,366 10/5/2017
1.0.0 1,412 7/25/2017
0.9.0 1,430 2/20/2017
0.8.0 1,673 11/11/2016
0.7.0 1,725 3/3/2016
0.6.2 1,729 1/27/2016
0.6.1 1,726 1/24/2016
0.6.0 1,683 1/23/2016
0.5.1 2,260 1/20/2016
0.5.0 1,655 1/10/2016
0.4.0 1,973 12/25/2015
0.3.0 2,332 12/24/2015