XParsec 0.3.0
dotnet add package XParsec --version 0.3.0
NuGet\Install-Package XParsec -Version 0.3.0
<PackageReference Include="XParsec" Version="0.3.0" />
<PackageVersion Include="XParsec" Version="0.3.0" />
<PackageReference Include="XParsec" />
paket add XParsec --version 0.3.0
#r "nuget: XParsec, 0.3.0"
#:package XParsec@0.3.0
#addin nuget:?package=XParsec&version=0.3.0
#tool nuget:?package=XParsec&version=0.3.0
<div align="center"> <h1 align="center"> <img alt="XParsec logo" src="docs/images/logo.svg" title="Logo" align="center"/> XParsec </h1> </div> <br/>
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 | 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 | 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. |
-
.NETStandard 2.0
- FSharp.Core (>= 8.0.300)
- System.Collections.Immutable (>= 8.0.0)
-
net8.0
- FSharp.Core (>= 8.0.300)
- System.Collections.Immutable (>= 8.0.0)
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.