Fast lightweight expression evaluator
Author: m | 2025-04-25
Fast Lightweight Expression Evaluator listed as FLEE. Fast Lightweight Expression Evaluator - How is Fast Lightweight Expression Evaluator abbreviated? https
Fast Lightweight Expression Evaluator - How is Fast Lightweight
Here are 63 public repositories matching this topic... Code Issues Pull requests Discussions A Json based Rules Engine with extensive Dynamic expression support Updated Mar 2, 2025 C# Code Issues Pull requests Discussions C# expressions interpreter Updated Mar 23, 2025 C# Code Issues Pull requests Fast Lightweight Expression Evaluator Updated Mar 22, 2022 C# Code Issues Pull requests A Simple Math and Pseudo C# Expression Evaluator in One C# File. Can also execute small C# like scripts Updated Sep 22, 2023 C# Code Issues Pull requests Discussions Editor for Microsoft RulesEngine - Blazor UI library intended for integration in Web or Desktop Updated Mar 6, 2025 C# Code Issues Pull requests C# Expression Parser for Unity3D Updated Mar 2, 2024 C# Code Issues Pull requests expression evaluator for .NET with built-in compiler Updated Sep 29, 2024 C# Code Issues Pull requests Discussions Expressive is a cross-platform expression parsing and evaluation framework. The cross-platform nature is achieved through compiling for .NET Standard so it will run on practically any platform. Updated Oct 1, 2024 C# Code Issues Pull requests yet another csharp expression parser Updated Jul 15, 2022 C# Code Issues Pull requests Matheval is a mathematical expressions evaluator library written in C#. Allows to evaluate mathematical, boolean, string and datetime expressions Updated Aug 26, 2024 C# Code Issues Pull requests A C# library for parsing mathemitical expressions with support for parentheses and variables. Updated Sep 1, 2024 C# Code Issues Pull requests SQL Eval Function | Dynamically Evaluate Expression in SQL Server using C# Syntax. Updated Mar 11, 2025 C# Code Issues Pull requests Discussions Expressions Evaluator for .NET Updated Jul 9, 2024 C# Code Issues Pull requests Evaluates a math expression from a string. Supports variables and custom operators. Updated Apr 24, 2024 C# Code Issues Pull requests Discussions This .NET library allows you to evaluate and compile any mathematical expression from a string dynamically at runtime. It supports a wide range of operations and allows for the use of custom variables, operators, and functions. The evaluator can be configured for different contexts, such as scientific, programming, boolean math expressions. Updated Dec 21, 2024 C# Code Issues Pull requests Simple math expression parser library for Unity Updated May 29, 2023 C# Code Issues Pull requests Easy to use extensible calculator for .NET. Demonstrates Sprache toolkit grammar inheritance. Updated Mar 9, 2019 C# Code Issues Pull requests Evaluate C# Formulas at Runtime Updated Oct 10, 2020 C# Code Issues Pull requests A simple runtime C# Interpreter [ single script ] [ easy-to-use ] [ 0 GC & 0 boxing] [rich feature] Updated Oct 10, 2024 C# Code Issues Pull requests Efficient Processing, Compilation, and Execution of Expression Trees at Runtime Updated Mar 10, 2025 C# --> Improve this page Add a description, image, and links to the expression-evaluator topic page so that developers can more easily learn about it. Curate this topic Add this topic to your repo To associate your repository with the expression-evaluator topic, visit your repo's landing Fast Lightweight Expression Evaluator listed as FLEE. Fast Lightweight Expression Evaluator - How is Fast Lightweight Expression Evaluator abbreviated? https Skip to content Navigation Menu GitHub Copilot Write better code with AI Security Find and fix vulnerabilities Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes Discussions Collaborate outside of code Code Search Find more, search less Explore Learning Pathways Events & Webinars Ebooks & Whitepapers Customer Stories Partners Executive Insights GitHub Sponsors Fund open source developers The ReadME Project GitHub community articles Enterprise platform AI-powered developer platform Pricing Provide feedback Saved searches Use saved searches to filter your results more quickly Sign up # expression-evaluator Star Here are 7 public repositories matching this topic... Code Issues Pull requests Discussions Kotlin Multiplatform runtime infix expressions evaluator. Updated Dec 5, 2024 Kotlin Code Issues Pull requests A Kotlin/Java based mathematical expression solver. Supports custom operators, variables, and functions. Updated Apr 18, 2017 Kotlin Code Issues Pull requests A wrapper of the mathjs.org ( JavaScript library for Android to evaluate math expressions. Updated Jan 23, 2020 Kotlin Code Issues Pull requests Parse expressions like "Hi #name, #{user.isNew ? 'you're gonna like it' : 'welcome back'}!" within 5 microseconds! (0.005 ms) Updated Jun 16, 2022 Kotlin Code Issues Pull requests MEE Math Expression Evaluator Updated Sep 1, 2021 Kotlin Code Issues Pull requests A kotlin based extensible calculator Updated Apr 4, 2021 Kotlin Code Issues Pull requests Library written in Kotlin to help evaluate mathematical expressions that can be extended by custom operators and functions. Updated Nov 29, 2020 Kotlin Improve this page Add a description, image, and links to the expression-evaluator topic page so that developers can more easily learn about it. Curate this topic Add this topic to your repo To associate your repository with the expression-evaluator topic, visit your repo's landing page and select "manage topics." Learn moreComments
Here are 63 public repositories matching this topic... Code Issues Pull requests Discussions A Json based Rules Engine with extensive Dynamic expression support Updated Mar 2, 2025 C# Code Issues Pull requests Discussions C# expressions interpreter Updated Mar 23, 2025 C# Code Issues Pull requests Fast Lightweight Expression Evaluator Updated Mar 22, 2022 C# Code Issues Pull requests A Simple Math and Pseudo C# Expression Evaluator in One C# File. Can also execute small C# like scripts Updated Sep 22, 2023 C# Code Issues Pull requests Discussions Editor for Microsoft RulesEngine - Blazor UI library intended for integration in Web or Desktop Updated Mar 6, 2025 C# Code Issues Pull requests C# Expression Parser for Unity3D Updated Mar 2, 2024 C# Code Issues Pull requests expression evaluator for .NET with built-in compiler Updated Sep 29, 2024 C# Code Issues Pull requests Discussions Expressive is a cross-platform expression parsing and evaluation framework. The cross-platform nature is achieved through compiling for .NET Standard so it will run on practically any platform. Updated Oct 1, 2024 C# Code Issues Pull requests yet another csharp expression parser Updated Jul 15, 2022 C# Code Issues Pull requests Matheval is a mathematical expressions evaluator library written in C#. Allows to evaluate mathematical, boolean, string and datetime expressions Updated Aug 26, 2024 C# Code Issues Pull requests A C# library for parsing mathemitical expressions with support for parentheses and variables. Updated Sep 1, 2024 C# Code Issues Pull requests SQL Eval Function | Dynamically Evaluate Expression in SQL Server using C# Syntax. Updated Mar 11, 2025 C# Code Issues Pull requests Discussions Expressions Evaluator for .NET Updated Jul 9, 2024 C# Code Issues Pull requests Evaluates a math expression from a string. Supports variables and custom operators. Updated Apr 24, 2024 C# Code Issues Pull requests Discussions This .NET library allows you to evaluate and compile any mathematical expression from a string dynamically at runtime. It supports a wide range of operations and allows for the use of custom variables, operators, and functions. The evaluator can be configured for different contexts, such as scientific, programming, boolean math expressions. Updated Dec 21, 2024 C# Code Issues Pull requests Simple math expression parser library for Unity Updated May 29, 2023 C# Code Issues Pull requests Easy to use extensible calculator for .NET. Demonstrates Sprache toolkit grammar inheritance. Updated Mar 9, 2019 C# Code Issues Pull requests Evaluate C# Formulas at Runtime Updated Oct 10, 2020 C# Code Issues Pull requests A simple runtime C# Interpreter [ single script ] [ easy-to-use ] [ 0 GC & 0 boxing] [rich feature] Updated Oct 10, 2024 C# Code Issues Pull requests Efficient Processing, Compilation, and Execution of Expression Trees at Runtime Updated Mar 10, 2025 C# --> Improve this page Add a description, image, and links to the expression-evaluator topic page so that developers can more easily learn about it. Curate this topic Add this topic to your repo To associate your repository with the expression-evaluator topic, visit your repo's landing
2025-04-12Skip to content Navigation Menu GitHub Copilot Write better code with AI Security Find and fix vulnerabilities Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes Discussions Collaborate outside of code Code Search Find more, search less Explore Learning Pathways Events & Webinars Ebooks & Whitepapers Customer Stories Partners Executive Insights GitHub Sponsors Fund open source developers The ReadME Project GitHub community articles Enterprise platform AI-powered developer platform Pricing Provide feedback Saved searches Use saved searches to filter your results more quickly Sign up # expression-evaluator Star Here are 7 public repositories matching this topic... Code Issues Pull requests Discussions Kotlin Multiplatform runtime infix expressions evaluator. Updated Dec 5, 2024 Kotlin Code Issues Pull requests A Kotlin/Java based mathematical expression solver. Supports custom operators, variables, and functions. Updated Apr 18, 2017 Kotlin Code Issues Pull requests A wrapper of the mathjs.org ( JavaScript library for Android to evaluate math expressions. Updated Jan 23, 2020 Kotlin Code Issues Pull requests Parse expressions like "Hi #name, #{user.isNew ? 'you're gonna like it' : 'welcome back'}!" within 5 microseconds! (0.005 ms) Updated Jun 16, 2022 Kotlin Code Issues Pull requests MEE Math Expression Evaluator Updated Sep 1, 2021 Kotlin Code Issues Pull requests A kotlin based extensible calculator Updated Apr 4, 2021 Kotlin Code Issues Pull requests Library written in Kotlin to help evaluate mathematical expressions that can be extended by custom operators and functions. Updated Nov 29, 2020 Kotlin Improve this page Add a description, image, and links to the expression-evaluator topic page so that developers can more easily learn about it. Curate this topic Add this topic to your repo To associate your repository with the expression-evaluator topic, visit your repo's landing page and select "manage topics." Learn more
2025-04-13Obtain a description of the failure when the evaluation fails.Custom SymbolsBelow is an example that provides a custom unary function that returns the twice the value it receives. There is also acustom variable called foo which holds the constant 123.4.Double] = ["twice": {$0 + $0}]let parser = MathParser(variables: myVariables.producer, unaryFunctions: myFuncs.producer)let evaluator = parser.parse("power(twice(foo))")# Expression parsed and `twice(foo)` resolved to `246.8` but `power` is still unknownevaluator?.value // => nanevaluator?.unresolved.unaryFunctions // => ['power']'# Give evaluator way to resolve `power(246.8)`let myEvalFuncs: [String:(Double)->Double] = ["power": {$0 * $0}]evaluator?.eval(unaryFunctions: myEvalFuncs.producer) // => 60910.240000000005">let myVariables = ["foo": 123.4]let myFuncs: [String:(Double)->Double] = ["twice": {$0 + $0}]let parser = MathParser(variables: myVariables.producer, unaryFunctions: myFuncs.producer)let evaluator = parser.parse("power(twice(foo))")# Expression parsed and `twice(foo)` resolved to `246.8` but `power` is still unknownevaluator?.value // => nanevaluator?.unresolved.unaryFunctions // => ['power']'# Give evaluator way to resolve `power(246.8)`let myEvalFuncs: [String:(Double)->Double] = ["power": {$0 * $0}]evaluator?.eval(unaryFunctions: myEvalFuncs.producer) // => 60910.240000000005Instead of passing a closure to access the dictionary of symbols, you can pass the dictionary itself: 60910.240000000005">let parser = MathParser(variableDict: myVariables, unaryFunctionDict: myFuncs)evaluator?.eval(unaryFunctionDict: myEvalFuncs) // => 60910.240000000005PrecedenceThe usual math operations follow the traditional precedence hierarchy: multiplication and division is above additionand subtraction, so 1 + 2 * 3 - 4 / 5 + 6 evaluates the same as 1 + (2 * 3) - (4 / 5) + 6. There are threeadditional operators, one for exponentiations (^) which is higher than the previous ones, so 2 * 3 ^ 4 + 5 is thesame as 2 * (3 ^ 4) + 5. It is also right-associative, so 2 ^ 3 ^ 4 is evaluated as 2 ^ (3 ^ 4) instead of(2 ^ 3) ^ 4.There are two other operations that are even higher in precedence than exponentiation:negation (-) -- -3.4factorial (!) -- 12!Note that factorial of a negative number is undefined, so negation and factorial cannot be combined. In other words,parsing -3! returns nil. Also, factorial is only done on the integral portion of a number, so 12.3! will parse butthe resulting value will be the same as 12!. In effect, factorial always operates as floor(x)! or !(floor(x)).Implied MultiplicationOne of the original goals of this parser was to be able to accept a Wolfram Alpha math expression more or less as-is-- for instance the definition -- withoutany editing. Here is the start of the textual representation from the above link:x(t) = ((-2/9 sin(11/7 - 4 t) + 78/11 sin(t + 11/7) + 2/7 sin(2 t
2025-04-07Swift-math-parserBasic math expression parser built with Point•Free'sswift-parsing package (v0.12.0). See the API documentation for developer info.NOTE: v3.1.0 uses swift-parsing v0.12 which requires Xcode 14 and ideally Swift 5.8(see their What's Changed doc for additional details).If you need to use an older version, use the tagged 3.0.1 release instead.Usage Example 0.0evaluator.eval("t", value: 0.25) // => 4.2426406871192848evaluator.eval("t", value: 0.5) // => 6evaluator.eval("t", value: 1.0) // => 0">let parser = MathParser()let evaluator = parser.parse("4 × sin(t × π) + 2 × sin(t × π)")evaluator.eval("t", value: 0.0) // => 0.0evaluator.eval("t", value: 0.25) // => 4.2426406871192848evaluator.eval("t", value: 0.5) // => 6evaluator.eval("t", value: 1.0) // => 0The parser will return nil if it is unable to completely parse the expression. Alternatively, you can call theparseResult to obtain a Swift Result enum that will have a MathParserError value when parsing fails. Thiswill contain a description of the parsing failure that comes from the swift-parsing library. input:1:81 | 4 × sin(t × π | ^ expected end of input)">let evaluator = parser.parseResult("4 × sin(t × π")print(evaluator)failure(error: unexpected input --> input:1:81 | 4 × sin(t × π | ^ expected end of input)By default, the expression parser and evaluator handle the following symbols and functions:Standard math operations: addition (+), subtraction (-), multiplication (*), division (/),and exponentiation (^)The factorial of a number (!) 1Constants: pi (π) and e1-argument functions: sin, asin, cos, acos, tan, atan, log10, ln (loge), log2, exp, ceil,floor, round, sqrt (√), cbrt (cube root), abs, sgn, and ! for factorial (see 1)2-argument functions: atan, hypot, pow 2alternative math operator symbols: × for multiplication and ÷ for division (see example above for use of ×)You can reference additional symbols or variables and functions by providing your own mapping functions. There are twoplaces where this can be done:MathParser.initEvaluator.evalIf a symbol or function does not exist during an eval call, the final result will be NaN. If a symbol is resolvedduring parsing, it will be replaced with the symbol's value. Otherwise, it will be resolved during a future eval call.Same for function calls -- if the function is known during parsing and all arguments have a known value, then it willbe replaced with the function result. Otherwise, the function call will take place during an eval call.You can get the unresolved symbol names from the Evaluator.unresolved attribute. It returns three collections forunresolved variables, unary functions, and binary function names. You can also use the evalResult to attempt anevaluation but also
2025-03-31DeucesA pure Python poker hand evaluation libraryInstallationImplementation notesDeuces, originally written for the MIT Pokerbots Competition, is lightweight and fast. All lookups are done with bit arithmetic and dictionary lookups. That said, Deuces won't beat a C implemenation (~250k eval/s) but it is useful for situations where Python is required or where bots are allocated reasonable thinking time (human time scale).Deuces handles 5, 6, and 7 card hand lookups. The 6 and 7 card lookups are done by combinatorially evaluating the 5 card choices, but later releases may have dedicated and faster algorithms for these.I also have lookup tables for 2 card rollouts, which is particularly handy in evaluating Texas Hold'em preflop pot equity, but they are forthcoming as well.See my blog for an explanation of how the library works and how the lookup table generation is done: (haven't posted yet)UsageDeuces is easy to set up and use.>> from deuces import Card>>> card = Card.new('Qh')">>>> from deuces import Card>>> card = Card.new('Qh')Card objects are represented as integers to keep Deuces performant and lightweight.Now let's create the board and an example Texas Hold'em hand:>> board = [>>> Card.new('Ah'),>>> Card.new('Kd'),>>> Card.new('Jc')>>> ]>>> hand = [>>> Card.new('Qs'),>>> Card.new('Th')>>> ]">>>> board = [>>> Card.new('Ah'),>>> Card.new('Kd'),>>> Card.new('Jc')>>> ]>>> hand = [>>> Card.new('Qs'),>>> Card.new('Th')>>> ]Pretty print card integers to the terminal:>> Card.print_pretty_cards(board + hand) [ A ❤ ] , [ K ♦ ] , [ J ♣ ] , [ Q ♠ ] , [ T ❤ ] ">>>> Card.print_pretty_cards(board + hand) [ A ❤ ] , [ K ♦ ] , [ J ♣ ] , [ Q ♠ ] , [ T ❤ ] If you have termacolor installed, they will be colored as well.Otherwise move straight to evaluating your hand strength:>> from deuces import Evaluator>>> evaluator = Evaluator()>>> print evaluator.evaluate(board, hand)1600">>>> from deuces import Evaluator>>> evaluator = Evaluator()>>> print evaluator.evaluate(board, hand)1600Hand strength is valued on a scale of 1 to 7462, where 1 is a Royal Flush and 7462 is unsuited 7-5-4-3-2, as there are only 7642 distinctly ranked hands in poker. Once again, refer to my blog post for a more mathematically complete explanation of why this is so.If you want to deal out cards randomly from a deck, you can also do that with Deuces:>> from deuces import Deck>>> deck = Deck()>>> board = deck.draw(5)>>> player1_hand = deck.draw(2)>>> player2_hand = deck.draw(2)">>>> from deuces import Deck>>> deck = Deck()>>> board = deck.draw(5)>>> player1_hand = deck.draw(2)>>> player2_hand = deck.draw(2)and print them:>> Card.print_pretty_cards(board) [ 4 ♣ ] , [ A ♠ ] , [ 5 ♦ ] , [ K ♣ ] , [ 2 ♠ ]>>> Card.print_pretty_cards(player1_hand) [ 6 ♣ ] , [ 7 ❤ ] >>> Card.print_pretty_cards(player2_hand) [ A ♣ ] , [ 3 ❤ ] ">>>> Card.print_pretty_cards(board) [ 4 ♣ ] , [ A ♠ ] , [ 5 ♦ ] , [ K ♣ ] , [ 2 ♠ ]>>> Card.print_pretty_cards(player1_hand) [ 6 ♣ ] , [ 7 ❤ ] >>> Card.print_pretty_cards(player2_hand) [ A ♣ ] , [ 3 ❤ ]
2025-04-12CalcexA simple mathematical expression parser and evaluator for .NET.This repository contains calcex.core, the actual .NET parser library, the calcex .NET Core CLI and a sample Windows GUI.OverviewCalcex.Core is a basic parser and evaluator library for mathematical expressions built on .NET Core.Some functionalities are:support for many common arithmetic and bitwise operators (*, ^, %, &, ...)support for many mathematical functions (sin, ln, log, min, ...)user-defined variables and functionsevaluate to double, decimal or boolean valuescompile expressions into callable delegatesconvert expressions to postfix notation and MathML stringsCalcex.Console contains a simple command-line interface that provides easy access to the mathematical evaluators.Calcex.Windows contains Calcex App, a basic GUI calculator app for Windows built using WPF.How To (Calcex.Core)Simple example func = tree.Compile("x");">Parser parser = new Parser();// Set a custom variableparser.SetVariable("x", -12);// Parsevar tree = parser.Parse("2*pi+5-x");// Evaluate to doubledouble doubleResult = tree.Evaluate();// Evaluate to decimaldecimal decimalResult = tree.EvaluateDecimal(); // Compile to delegateFuncdouble, double> func = tree.Compile("x");Fore more, visit the Calcex wiki.LicenseCalcex is published under BSD-3-Clause license.
2025-04-06