SpiseMisu.ParserCombinator 0.11.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package SpiseMisu.ParserCombinator --version 0.11.9                
NuGet\Install-Package SpiseMisu.ParserCombinator -Version 0.11.9                
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="SpiseMisu.ParserCombinator" Version="0.11.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SpiseMisu.ParserCombinator --version 0.11.9                
#r "nuget: SpiseMisu.ParserCombinator, 0.11.9"                
#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.
// Install SpiseMisu.ParserCombinator as a Cake Addin
#addin nuget:?package=SpiseMisu.ParserCombinator&version=0.11.9

// Install SpiseMisu.ParserCombinator as a Cake Tool
#tool nuget:?package=SpiseMisu.ParserCombinator&version=0.11.9                

SpiseMisu.ParserCombinator

Efficient CharStream parser-combinator in F#

Demo

#!/usr/bin/env -S dotnet fsi --langversion:8.0 --optimize --warnaserror+:25,26

//#I @"../SpiseMisu.ParserCombinator/bin/Release/net8.0/"
//#r @"SpiseMisu.ParserCombinator.dll"

#r "nuget: SpiseMisu.ParserCombinator, 00.11.09"

#time "on"

open System

open SpiseMisu.Parser
open SpiseMisu.Parser.Converters
open SpiseMisu.Parser.Combinator

module rec FooBar =
  
  type t =
    | Foo of t seq
    | Bar of int
  
  let foobarP () =
        barP
    <|> fooP
  
  let barP =
    ( Chars.toInt >> Bar
    )
    <!> numsP
  
  let foobarsP =
    sepBy
      ( defer foobarP )
      ( manyP spaceP *> charP ',' <* manyP spaceP )
  
  let fooP =
    ( Foo
    )
    <!> charP '[' *> manyP spaceP *> foobarsP <* manyP spaceP <* charP ']'

open FooBar

let _ =
  
  "[\t00, [ \n1337,2     , 42]     ]"
  
  (* Should be parsed as:
     > Foo (seq [Bar 0; Foo (seq [Bar 1337; Bar 2; Bar 42])])
  *)
  
  |> run (defer foobarP)
  |> function
    | Ok    a -> printfn "# Parse:\n%A" a
    | Error e -> printfn "# Error:\n%s" e
  
  0

NOTE: The demo script is available at: ./demo/foobar.fsx.

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.11.14 63 12/23/2024
0.11.13 80 12/19/2024
0.11.12 74 12/19/2024
0.11.11 71 12/19/2024
0.11.10 65 12/19/2024
0.11.9 85 12/7/2024
0.11.8 81 12/7/2024
0.11.7 186 5/15/2023
0.11.6 163 5/15/2023
0.11.5 154 5/15/2023
0.11.4 153 5/15/2023
0.11.3 168 5/15/2023
0.11.2 161 5/15/2023
0.11.1 165 5/14/2023
0.11.0 167 5/14/2023