Formula.Parser 1.3.0

dotnet add package Formula.Parser --version 1.3.0
                    
NuGet\Install-Package Formula.Parser -Version 1.3.0
                    
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="Formula.Parser" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Formula.Parser" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Formula.Parser" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Formula.Parser --version 1.3.0
                    
#r "nuget: Formula.Parser, 1.3.0"
                    
#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.
#:package Formula.Parser@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Formula.Parser&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Formula.Parser&version=1.3.0
                    
Install as a Cake Tool

formula

A simple extensible formula language for .NET

Syntax

  • Arithmetic: + - * % / ^ ( )
  • Functions: FunctionName(Parameter, Parameter, ...)
  • Variables: VariableName OR [Variable Name With Spaces]
    • Ranges: VariableName|LowerExpr:UpperExpr| OR [Variable Name With Spaces]|LowerExpr:UpperExpr|
    • Indices: VariableName|IndexExpr| OR [Variable Name With Spaces]|IndexExpr|
  • Constants:
    • Number: 123.0
    • Boolean: true/false
    • Text: "A string"
    • Nothing: null
  • Branching: IF Expr THEN Expr ELSE Expr
  • Logical: = <> > < >= ⇐ ! && ||
  • Coalesce: ??

Examples

  • (1 + 2) * 3
  • SQRT(16)
  • MyVar * 2

Usage

  • From C#
    • CsWrapper.InterpretFormula("Test * 2", new Dictionary<string, double>() { { "Test", 1 } }, DefaultFunctionProvider.Instance)
    • CsWrapper.ParseFormula("Test * 2")
  • From F#
    • Formula.Parser.Parser.parseFormulaString
    • Formula.Parser.Interpreter.interpretFormula

Version History

1.3.0

  • DIV and SUMPRODUCT functions

1.2.0

  • Nothing (null) coalescing operator '??'
  • IFNULL and COALESCE functions

1.1.1

  • IL emit based compiler index lookup bug fix

1.1.0

  • IL emit based compiler
  • ExtractExpressionDependenciesWithRanges bug fix for partially resolved ranges

1.0.0

  • Bug fix for large expressions

0.13.0

  • Constant folder supports folding functions with constant arguments
    • Function implementations can declare they are deterministic
    • EmptyFunctionProvider created
  • Implicit cast from nullables fix/improvement

0.12.0

  • Support for 'Nothing' data type
    • Compiler & interpreter return an Option float value
    • C# wrapper returns Nullable<double>
    • Handling of Nothing values in aggregation functions
  • IFunctionProvider returns typed results
  • 'null' keyword added

0.11.0

  • Parser detection of ranges used outside of function parameters
  • Remove implicit use of the first range value in operations

0.10.1

  • Bug fix for duplicate dependencies being returned from DependencyExtractor

0.10.0

  • Syntax support for offsets/indices on variables e.g. MyVar|1|
  • FIRST, LAST, MIN, MAX functions
  • Added FunctionValidator to validate function calls after parsing

0.9.0

  • Support escaped characters in string literals
  • Missing dependencies reported from dependency extractor with function defined ranges

0.8.0

  • Better parser error reporting - new ParserException
  • Position information reported from parser
  • Position information reported by dependency extractor

0.7.0

  • Syntax support for ranges on variables e.g. MyVar|1:5|
  • Range support for variable providers
  • Range dependency information
  • SUM, AVG functions

0.6.0

  • Typing changes to allow for typed function parameters - number, boolean, text

0.5.1

  • Target .NETStandard 2.0

0.5.0

  • Syntax changes
    • Support for escaping identifiers between []
    • Change function parameters to use ()

0.4.0

  • Financial functions
  • Dependency extractor
  • Composite IVariableProvider
  • Mutable IVariableProvider
  • Testing enhancements

0.3.0

  • Expression compiler
  • Branching & logical operators
  • Expression based IVariableProvider
  • Composite IFunctionProvider

0.2.0

  • Extension points for functions and variables
    • IFunctionProvider
    • IVariableProvider
  • Modulus function & operator
    • MOD
    • %

0.1.0

  • Support basic arithmetic
    • Addition/Subtraction
    • Multiplication/Division
    • Exponentiation
    • Negation
  • Handful of functions
    • SQRT
    • PI
    • POW
    • COUNT
  • Constant valued variables
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.  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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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

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
1.3.0 253 9/1/2025
1.2.0 229 8/28/2025
1.1.1 412 5/7/2025
1.1.0 2,287 3/13/2024
1.0.0 962 5/9/2022
0.13.0 670 7/30/2021
0.12.0 505 7/28/2021
0.11.0 632 6/23/2021
0.10.1 489 6/21/2021
0.10.0 494 6/3/2021
0.9.0 456 6/1/2021
0.8.0 473 3/29/2021
0.7.0 493 3/18/2021
0.6.0 524 3/16/2021
0.5.1 537 2/9/2021
0.5.0 500 2/9/2021
0.4.0 471 2/8/2021
0.3.0 1,591 2/18/2018
0.2.0 1,473 2/11/2018
0.1.0 1,675 1/31/2018