FslexFsyacc 1.2.28
See the version list below for details.
dotnet add package FslexFsyacc --version 1.2.28
NuGet\Install-Package FslexFsyacc -Version 1.2.28
<PackageReference Include="FslexFsyacc" Version="1.2.28" />
paket add FslexFsyacc --version 1.2.28
#r "nuget: FslexFsyacc, 1.2.28"
// Install FslexFsyacc as a Cake Addin #addin nuget:?package=FslexFsyacc&version=1.2.28 // Install FslexFsyacc as a Cake Tool #tool nuget:?package=FslexFsyacc&version=1.2.28
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.
1. 可以重复非终结符产生式:已经实现了
list 代替 array
错误检测:产生式不重复,产生式的名称不能重名,不能与现有token重名。
错误检测:无限递归的非终结符。
规则簇(bunch)
改名:precedence level
6. 三部分改为两部分。规则,定义坚持显式解决冲突
优先级也可以带类型 一个符号就是一个名字,符号加上和它相关的语义值称为符记。token被抽象成一个名称,类型,符号。 产生式名称称呼!
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 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. |
-
.NETStandard 2.0
- FSharp.Core (>= 6.0.5)
- FSharp.Idioms (>= 1.2.9)
- FSharp.Literals (>= 2.2.9)
- FslexFsyacc.Runtime (>= 1.2.19)
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 | 178 | 7/16/2024 |
1.5.3 | 128 | 7/5/2024 |
1.5.2 | 162 | 7/1/2024 |
1.5.1 | 135 | 6/10/2024 |
1.5.0 | 153 | 6/4/2024 |
1.4.0 | 106 | 5/30/2024 |
1.3.18 | 124 | 3/29/2024 |
1.3.17 | 121 | 3/8/2024 |
1.3.16 | 105 | 3/6/2024 |
1.3.15 | 168 | 1/11/2024 |
1.3.14 | 119 | 1/9/2024 |
1.3.13 | 130 | 12/29/2023 |
1.3.12 | 126 | 12/27/2023 |
1.3.11 | 174 | 11/20/2023 |
1.3.10 | 155 | 9/9/2023 |
1.3.9 | 242 | 3/18/2023 |
1.3.8 | 221 | 3/14/2023 |
1.3.7 | 220 | 3/14/2023 |
1.3.6 | 230 | 3/12/2023 |
1.3.5 | 257 | 2/18/2023 |
1.3.4 | 282 | 2/2/2023 |
1.3.3 | 295 | 1/30/2023 |
1.3.2 | 331 | 12/29/2022 |
1.3.1 | 298 | 12/20/2022 |
1.3.0 | 396 | 10/16/2022 |
1.2.31 | 418 | 9/15/2022 |
1.2.30 | 396 | 8/28/2022 |
1.2.29 | 404 | 8/28/2022 |
1.2.28 | 391 | 8/24/2022 |
1.2.27 | 422 | 6/28/2022 |
1.2.26 | 427 | 6/27/2022 |
1.2.25 | 409 | 6/23/2022 |
1.2.24 | 426 | 5/25/2022 |
1.2.23 | 410 | 5/24/2022 |
1.2.22 | 413 | 5/24/2022 |
1.2.21 | 425 | 5/23/2022 |
1.2.20 | 407 | 5/22/2022 |
1.2.19 | 394 | 5/20/2022 |
1.2.18 | 396 | 5/20/2022 |
1.2.17 | 424 | 5/16/2022 |
1.2.16 | 405 | 5/8/2022 |
1.2.15 | 405 | 5/3/2022 |
1.2.14 | 411 | 4/26/2022 |
1.2.13 | 412 | 4/25/2022 |
1.2.12 | 407 | 4/24/2022 |
1.2.11 | 412 | 4/21/2022 |
1.2.10 | 419 | 4/18/2022 |
1.2.9 | 415 | 4/15/2022 |
1.2.8 | 424 | 4/8/2022 |
1.2.7 | 415 | 4/7/2022 |
1.2.6 | 442 | 2/12/2022 |
1.2.5 | 439 | 2/1/2022 |
1.2.4 | 431 | 1/23/2022 |
1.2.3 | 427 | 1/21/2022 |
1.2.2 | 421 | 1/20/2022 |
1.2.1 | 415 | 1/18/2022 |
1.2.0 | 262 | 12/31/2021 |
1.1.5 | 261 | 12/29/2021 |
1.1.4 | 249 | 12/28/2021 |
1.1.3 | 252 | 12/28/2021 |
1.1.2 | 255 | 12/27/2021 |
1.1.1 | 249 | 12/26/2021 |
1.1.0 | 295 | 12/19/2021 |
1.0.4 | 288 | 12/5/2021 |
1.0.3 | 269 | 12/4/2021 |
1.0.2 | 259 | 12/4/2021 |
1.0.1 | 279 | 11/28/2021 |
1.0.0 | 271 | 11/28/2021 |
array->list