Files
mrgameeng/src/MrGameEng.Core/Formulas/FormulaException.cs
T
Leonid PershinandClaude Opus 4.8 10898b08a0
CI / build-test (push) Successful in 1m19s
Add formula engine: data-driven expression evaluator (Core)
Keystone for the gene system. A Formula compiles a string from a def
(lexer -> recursive-descent parser -> tree of Func<IFormulaContext,float>)
once, then evaluates allocation-free against a variable context.

Supports + - * / %, comparisons, && || !, ternary, the constants
pi/tau/e, and functions abs sign floor ceil round sqrt exp log sin cos
tan min max pow clamp lerp step. Deterministic and side-effect-free so
gene-effect formulas stay pure. Covered by FormulaTests (parsing,
precedence, functions, logic/ternary, variables, errors).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 23:26:06 +03:00

13 lines
451 B
C#

namespace MrGameEng.Formulas;
/// <summary>
/// Thrown when a <see cref="Formula"/> cannot be lexed or parsed, or when a compiled formula
/// references a variable the context cannot resolve at evaluation time.
/// </summary>
public sealed class FormulaException : Exception
{
/// <summary>Creates the exception with a human-readable <paramref name="message"/>.</summary>
public FormulaException(string message)
: base(message) { }
}