FslexFsyacc 1.2.14

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

// Install FslexFsyacc as a Cake Tool
#tool nuget:?package=FslexFsyacc&version=1.2.14                

FslexFsyacc & Runtime

Tools and Runtime for Fslex/Fsyacc analyzer/parser generation tools.

Fslex is a code generator that uses regular expression syntax as a rule to generate a function, which divides the input token sequence into groups at a higher level. The Fslex is often used to remove redundant delimiters, add omitted delimiters or other syntax components, and so on. The Fslex is also used to determine context somewhere in the stream.

Fsyacc is a code generator that use BNF productions and precedences as a rule to generate a function, which resolves the input token sequence to an abstract syntax tree.

Fsyacc Example

Dragon book fig 4-59 example expr.fsyacc, fsyacc input file:

%{
open Expr.ExprToken
%}
expr : expr "+" expr         { s0 + s2 }
     | expr "-" expr         { s0 - s2 }
     | expr "*" expr         { s0 * s2 }
     | expr "/" expr         { s0 / s2 }
     | "(" expr ")"          { s1 }
     | "-" expr %prec UMINUS { -s1 }
     | NUMBER                { s0 }
%%
%left "+" "-"
%left "*" "/"
%right UMINUS
%%
NUMBER : "float"
expr   : "float"

After ParseTable module is generated, you can use the parse function to work:

let inp = "2 + 3 * 5"
let y = 
    inp
    |> ExprToken.tokenize
    |> ExprParseTable.parse
Should.equal y 17.0

Fslex Example

The ch8.6 Some Recursive Descent Parsing in Expert F# 4.0, the fslex input file:

%{
open PolynomialExpressions.Tokenizer
type token = int*int*Token
%}
index = "**" INT
sign = [ "+" "-" ]
%%
<sign>? INT { // multiline test
              toConst lexbuf }
<sign>? INT? ID <index>? { toTerm lexbuf }

After DFA module is generated, you can use the split function to work:

let x = "2x**2+3x-5"
let y = 
    x 
    |> Tokenizer.tokenize
    |> TermDFA.analyze
    |> Seq.toList

Should.equal y [Term(2,"x",2);Term(3,"x",1);Const -5]

Why use this package?

  • You can use your existing handwriting tokenizer.

  • This package uses standard lex/yacc syntax to minimize your learning costs.

  • fslex/fsyacc generates respectively an independent, side-effect-free function that can be called flexibly.

  • The method of generating code is simple, without command lines and without the need to configure projects.

  • The result code is data-driven and highly readable.

  • Flexiblely compose of tokenize, regular expressions, BNF technology.

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. 
.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 FslexFsyacc:

Package Downloads
UnquotedJson

A JSON parser.

FslexFsyacc.Bootstrap

Tools for Fslex/Fsyacc analyzer/parser generation.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.4 175 7/16/2024
1.5.3 127 7/5/2024
1.5.2 161 7/1/2024
1.5.1 134 6/10/2024
1.5.0 152 6/4/2024
1.4.0 105 5/30/2024
1.3.18 121 3/29/2024
1.3.17 120 3/8/2024
1.3.16 104 3/6/2024
1.3.15 167 1/11/2024
1.3.14 118 1/9/2024
1.3.13 129 12/29/2023
1.3.12 125 12/27/2023
1.3.11 173 11/20/2023
1.3.10 154 9/9/2023
1.3.9 241 3/18/2023
1.3.8 220 3/14/2023
1.3.7 219 3/14/2023
1.3.6 229 3/12/2023
1.3.5 256 2/18/2023
1.3.4 281 2/2/2023
1.3.3 294 1/30/2023
1.3.2 330 12/29/2022
1.3.1 297 12/20/2022
1.3.0 395 10/16/2022
1.2.31 417 9/15/2022
1.2.30 395 8/28/2022
1.2.29 403 8/28/2022
1.2.28 390 8/24/2022
1.2.27 421 6/28/2022
1.2.26 426 6/27/2022
1.2.25 408 6/23/2022
1.2.24 425 5/25/2022
1.2.23 409 5/24/2022
1.2.22 412 5/24/2022
1.2.21 424 5/23/2022
1.2.20 406 5/22/2022
1.2.19 393 5/20/2022
1.2.18 395 5/20/2022
1.2.17 423 5/16/2022
1.2.16 404 5/8/2022
1.2.15 404 5/3/2022
1.2.14 410 4/26/2022
1.2.13 411 4/25/2022
1.2.12 406 4/24/2022
1.2.11 411 4/21/2022
1.2.10 418 4/18/2022
1.2.9 414 4/15/2022
1.2.8 423 4/8/2022
1.2.7 414 4/7/2022
1.2.6 441 2/12/2022
1.2.5 437 2/1/2022
1.2.4 430 1/23/2022
1.2.3 426 1/21/2022
1.2.2 420 1/20/2022
1.2.1 414 1/18/2022
1.2.0 261 12/31/2021
1.1.5 260 12/29/2021
1.1.4 248 12/28/2021
1.1.3 251 12/28/2021
1.1.2 254 12/27/2021
1.1.1 248 12/26/2021
1.1.0 294 12/19/2021
1.0.4 287 12/5/2021
1.0.3 268 12/4/2021
1.0.2 258 12/4/2021
1.0.1 276 11/28/2021
1.0.0 270 11/28/2021

FsyaccFile.refineRules()