Farkle Versions Save

LALR parser combinators for C# and F#.

6.5.1

1 year ago
  • Fixed a bug where the precompiler would not work on .NET Framework editions of MSBuild, like in Visual Studio for Windows, when targeting frameworks greater than .NET 6.

6.5.0

1 year ago
  • Added an overload of the MarkForPrecompile extension method that enables the precompiler to be used in AOT environments. See https://teo-tsirpanis.github.io/Farkle/the-precompiler.html#Using-the-precompiler-in-AOT-environments for more details.
  • Frequently used post-processors will no longer be optimized using dynamic code generation, because of concerns about the code generator's robustness. Performance might slightly regress. A more robust code generation system might be introduced in a future version of Farkle.
  • More methods in the builder check their arguments for null and throw ArgumentNullExceptions.
  • Some documentation was fixed.
  • The nullability annotations for some generic methods in the builder were fixed.
  • Added params in the array parameter overload of Nonterminal.CreateUntyped that takes a name and a series of production builders.
  • The color of the goto cells in the HTML tables was changed to a brighter shade of blue whose contrast is compliant with WCAG 2 AA.
  • C# users can now define single-member productions by directly calling Finish(Constant) without calling Appended() or Extending(). Previously only some combinations were supported (Finish on typed designtime Farkles and FinishConstant on literals), but now all can be used.
  • The HTML DFA States tables were restyled to make them consistent with the LALR States tables. In particular the columns were swapped and the dark grey background of the character cells was removed.
  • The farkle new command will place the output in the current directory instead of the input grammar's or assembly's directory, if not given an output path by the user.
  • The Production<T> type became a covariant interface, fixing issue #26. Because it used to be a sealed class with no members, it is not expected to be a breaking change. User code is not allowed to implement it.
  • Trimming warnings were reduced. A couple of them remain and might appear when building grammars without the precompiler, but they pose no risk, removing them was non-trivial.

6.4.0

2 years ago
  • Breaking change: Farkle.Tools.MSBuild require MSBuild 17, which comes with Visual Studio 2022 and the .NET 6 SDK.
  • Farkle supports precompiling .NET 6 assemblies from Visual Studio.
  • Fixed random compiler errors when using the F# production builder operators .>> and .>>..
  • The precompiler supports writing both a conflict report and detailed MSBuild errors via the FarklePrecompilerErrorMode property. Its allowed values are ReportOnly (default), ErrorsOnly and Both.
  • String regexes support specifying predefined sets by their property name as well. For example, until now you could match all characters in the Greek Extended character set by specifying \p{Greek Extended}. From now on, \p{GreekExtended} will work too.
  • Various bug fixes, particularly in the precompiler.

6.3.2

2 years ago
  • Fixed a bug where the precompiler would not work on .NET Framework editions of MSBuild, like in Visual Studio for Windows.

6.3.1

2 years ago
  • Minor breaking change: Farkle.Builder.RegexGrammar.designtime's type became a regular DesigntimeFarkle<Regex>, after being changed to a Nonterminal<Regex> in Farkle 6.3.0 by mistake. This change is unlikely to affect any regular user of Farkle.
  • Fixed a bug where Farkle's assembly was not shrunk enough when trimmed.

6.3.0

2 years ago
  • Minor breaking change: Text with legacy CR line endings is no longer supported. Since this version, they will no longer be recognized as line endings by position tracking. When Farkle's next major version gets released, they will cause lexical errors.
  • Minor breaking change: The Farkle.Builder.GrammarMetadata type has an additional field of type Farkle.Builder.OperatorPrecedence.OperatorScope. User code that does not directly set metadata to designtime Farkles is not affected.
  • The precompiler will now generate an HTML report if a grammar has LALR conflicts.
  • The precompiler now works on Visual Studio for Windows. In this case only, it requires to install the .NET tool Farkle.Tools.
  • When building a grammar, if Farkle cannot distinguish between two symbols, it will now include an example word that made it indecisive in the error message. A new build error type named IndistinguishableSymbols2 was introduced.
  • Any type of designtime Farkle can now be renamed or set metadata like case sensitivity, comments or operator scopes, without using the DesigntimeFarkle.cast function. There were some binary breaking changes but none is source breaking.
  • Operator scopes will now correctly recognize multiple representations of the same designtime Farkle, such as an original terminal and a renamed one, or a string, and a designtime Farkle created with the literal operator that got passed the same string.
  • Fixed a bug on the new CLI tool command where the --prop option could not be specified more than once.
  • Fixed a bug where the new CLI tool command could not be used on projects or assemblies.
  • Fixed a bug where titlecase letters were not excluded when building case-insensitive grammars.
  • Fixed a bug where the sepBy operator could not match exactly one item.

6.2.0

2 years ago
  • Breaking change: The Farkle.Builder.LALRBuildTypes module, as well as most functions of the Farkle.Builder.LALRBuild module became internal.
  • Minor breaking change: Whitespace inside the "between", "at least" and "exactly n times" regex string quantifiers is no longer allowed. Using string regexes like \d{ 4} will cause an error.
  • Minor breaking change: The Farkle.Builder.IRawDelegateProvider interface and a function in the Farkle.Builder.DFABuild module became private. They were public by accident and served no purpose for Farkle's users.
  • Minor breaking change: Users that write their own tokenizers must ensure that CRLF line endings are Advanced at once, otherwise the character stream's position will be incorrect. The vast majority of use cases (those that doesn't involve custom tokenizers) will not be affected by this change.
  • Minor breaking change: Terminals, literals, and groups that are case-insensitively named NewLine will have an underscore prepended to their name when built, making them _NewLine for example. This change is a temporary workaround for a design deficiency of Farkle, where these terminals could end line groups and comments. It will be thoroughly fixed in the next major version. Because these names are only used for diagnostics and documentation generation, parser behavior will not be affected by this change. Nor will grammars read by EGT files be changed.
  • Minor breaking change: The \s and \S string regex symbol will now match exactly either horizontal tabs, line feeds, carriage returns or spaces. Other characters like vertical tabs and non-breaking spaces are no longer matched. This change matches Farkle's definition of whitespace. To revert to the previous behavior use \p{Whitespace} or \P{Whitespace}.
  • Farkle's string regexes got many improvements and bug fixes, bringing their syntax closer -but not a 100% match- to popular regex languages. Take a look at the string regex reference for more details.
  • The precompiler now works when used on a project targeting a framework earlier than .NET Core 3.1.
  • The Position.Advance method got a new overload that accepts a ReadOnlySpan of characters. It is recommended over the existing one that accepts a single character because it reliably handles line endings.
  • Building a grammar can now be cancelled by new functions introduced in Farkle.Builder's DFABuild, LALRBuild and DesigntimeFarkleBuild modules. Additionally the Build and BuildUntyped extension methods of designtime Farkles now accept an optional cancellation token.
  • Fixed a bug where the wrong error position was sometimes reported on text with LF line endings.
  • Fixed a bug where the wrong error position was reported on syntax errors.

6.1.0

3 years ago
  • Some typos were fixed in Farkle's HTML templates.
  • The ParserApplicationExceptionWithPosition type was deprecated in favor of a new constructor in ParserApplicationException.
  • The EGT file reader will throw an exception if it tries to load a grammar file that shifts on EOF in one of its LALR states (which would cause infinite loops).
  • The designtime Farkles that are returned by the many and many1 operators now have the correct name.
  • Throwing a ParserException during post-processing will not be thrown in user code inside a PostProcessorException, but will be caught by the runtime Farkle API, allowing to customize the parser error message in greater detail.

6.0.0

3 years ago
  • Breaking change: The functions RuntimeFarkle.ofEGTFile and RuntimeFarkle.ofBase64Stringas well as their corresponding RuntimeFarkle static methods were removed. Users are advised to migrate away from GOLD Parser.
  • Breaking change: The RuntimeFarkle.GetBuildError method was replaced by GetBuildErrors, which returns a list of build errors.
  • Breaking change: The Farkle.Grammar.Grammar.Properties member now holds a strongly-typed record of informative grammar properties. Unrecognized GOLD Parser properties such as "Author", "Description" and "Version" are discarded. Existing grammar files remain compatible.
  • Breaking change: The members of Farkle's discriminated unions can no longer be accessed in F# using a method. For example, let foo (x: Terminal) = printfn "%s" x.Name becomes let foo (Terminal(_, name)) = printfn "%s" name. For C# users, duplicate properties like Terminal.name with a lowercase "n" were removed; they are replaced by their corresponding title-cased properties.
  • Breaking change: The members of many of Farkle's discriminated unions got meaningful names. C# code using the older names might break.
  • Breaking change: Removed support for generating legacy grammar skeleton files from MSBuild using the Farkle item.
  • Breaking change: The Farkle.Common.SetOnce type became internal.
  • Farkle's types and methods support C# 8.0's Nullable Reference Types.
  • Farkle's builder supports defining operator precedence and associativity to resolve conflicts. The quick start guide was updated.
  • Farkle supports virtual terminals -terminals that are not backed by the default tokenizer's DFA but created by custom tokenizers-, allowing for scenarios like indent-based grammars. An F# sample of an indent-based grammar was published.
  • Dynamic code generation will be applied to post-processors that are frequently used, in a fashion similar to .NET's tiered compilation, regardless of whether their designtime Farkle is precompilable.
  • Build error reporting is improved. More build errors will be reported at the same time, without having to fix one to show the next.
  • Stack overflows when building extremely complex designtime Farkles were either mitigated or will throw recoverable exceptions.

6.0.0-alpha.3

3 years ago
  • Breaking change: .NET Framework 4.5 is no longer supported. The library targets .NET Standard 2.0, .NET Standard 2.1 and .NET 5.
  • Breaking change: Logging parser events is no longer supported. The logging function was removed from the signatures of parser APIs.
  • Breaking change: The function LALRParser.parseLALR was renamed to LALRParser.parse.
  • Breaking change: The Farkle.Parser.OptimizedOperations type was made internal.
  • Breaking change: Transformers no longer take the position of a terminal, but an ITransformerContext type containing more information.
  • Breaking change: Farkle's exception types were refactored. They inherit from FarkleException.
  • Breaking change: Post-processor exceptions are wrapped inside a PostProcessorException and thrown to user code.
  • Breaking change: Only objects of type PrecompilableDesigntimeFarkle can be marked for precompilation.
  • Minor breaking change: The Transformers and Fusers properties were removed from the Farkle.Builder.GrammarDefinition type.
  • Farkle will now optimize precompilable designtime Farkles using dynamic code generation. This feature is only supported on .NET Standard 2.1 if the runtime supports dynamic code compilation.
  • An API for the CharStream type was published.
  • An API for getting precompiled grammars was published.
  • The tokenizer can be extended by user code. TODO: write documentation
  • The runtime Farkle's extension methods became regular methods.
  • Exceptions that might occur when a precompiled grammar fails to be loaded can be suppressed with an AppContext switch.