texpr 0.1.4 copy "texpr: ^0.1.4" to clipboard
texpr: ^0.1.4 copied to clipboard

A Dart library for parsing, evaluating, and analyzing mathematical expressions in LaTeX. Supports symbolic calculus, matrices, and complex numbers.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased #

0.1.4 - 2026-02-24 #

Added #

  • Compile-time evaluability annotation: parser now annotates every AST node with EvaluabilityInfo during parse.
  • New AST metadata API via Expression.compileTimeEvaluabilityInfo for tooling and diagnostics.
  • Added TDD coverage for parser-time annotation and context-aware resolution in test/core/compile_time_evaluability_test.dart.
  • Added v0.1.4 improvement plan to roadmap (correctness, benchmarks, docs, migration guidance).
  • JSON AST export now supports toJson(includeEvaluability: true) to include optional compile-time evaluability metadata.
  • Added CI workflow with SymPy smoke verification (Dart export + Python validation with tolerance checks).
  • Added evaluability fast-path micro-benchmark and CI guardrail artifact generation.
  • Added migration guide for deprecated isValid() / validate() APIs: doc/guide/migration-validate.md.

Fixed #

  • getEvaluability() now uses compile-time metadata when available, avoiding repeated full-tree traversals for parsed expressions.
  • Normalized structural cache keys for floating-point edge values so -0.0 and 0.0 map to the same key and NaN is handled consistently.
  • Updated README and docs links/examples to match current project structure and versioning.

Removed #

0.1.3 - 2026-01-12 #

Boolean Logic, Bug Fixes & Doc Improvements

Added #

  • Boolean Algebra: Full support for boolean operators (\land, \lor, \neg, \implies, etc.) and comparisons (>, <, =, \ge, \le). Comparisons returning BooleanResult are strictly type-checked.
  • Documentation: Added dedicated Boolean Logic guide.
  • Infrastructure: Migrated documentation site from Tailwind CSS to UnoCSS.

Fixed #

  • Caching Bug: Fixed a critical hash collision issue in CacheManager where 0 > 1 would incorrectly return true due to colliding with 1 > 0.
  • Regression: Resolved a regression causing LateInitializationError in CacheManager.

0.1.2 - 2026-01-09 #

Real-Only Mode for Graphing Applications

Added #

  • Interval Arithmetics: Added support for interval arithmetics.
  • Real-Only Mode: Added realOnly parameter to Texpr, Evaluator, and EvaluationVisitor classes. When enabled, operations that would produce complex numbers (like sqrt(-1) or ln(-1)) return NaN instead. This provides Desmos-like behavior for graphing applications.
// Default: complex number support
final texpr = Texpr();
texpr.evaluate(r'\sqrt{-1}'); // Returns ComplexResult(0 + 1i)

// Real-only mode: NaN for undefined real operations
final texprGraph = Texpr(realOnly: true);
texprGraph.evaluate(r'\sqrt{-1}'); // Returns NumericResult(NaN)

Changed #

  • FunctionRegistry: Refactored to support real-only aware function handlers alongside standard handlers.

  • isValid() and validate(): Use parse() with try/catch instead. These methods will be removed in 1.0.0.

0.1.1 - 2026-01-07 #

Bug Fixes & UX Improvements

  • Parsing: Fixed strict syntax parsing for integral bounds (e.g., \int_0^1 is now supported).
  • Evaluation: Fixed evaluateNumeric behavior for complex numbers; results are now handled correctly when using evaluate().
  • JSON Export: Fixed VectorExpr JSON schema to use components key, matching the AST definition.

Added #

  • LaTeX Commands: Implemented support for common academic symbols:
    • Arrows: \mapsto, \Rightarrow, \Leftarrow, \Leftrightarrow.
    • Relation & Set Operators: \approx, \propto, \cup, \cap, \setminus, \subset, \subseteq, \supset, \supseteq.
    • Quantifiers: \forall and \exists (parsed as variables for syntax tolerance).
    • Decorations: \dot, \ddot, and \bar functions for physics and statistical notation.

Changed #

  • Breaking Change: Renamed LatexException to TexprException (and LatexParserException -> ParserException, etc.) to better align with the library name.
  • Error Messages: Significantly improved parser error clarity. Error messages now use readable symbols (e.g., got: '*') instead of internal enum names (e.g., got: multiply).
  • Parser: Improved syntax tolerance for known commands on implicit multiplication (e.g., sin(x)).
  • Documentation: Updated feature guides, notation references, and example code.

0.1.0 - 2026-01-02 #

Draft Release: Benchmarks, WASM, and Documentation Overhaul.

  • WASM Support: Added initial WebAssembly compilation targets and examples (wasm/).
  • Benchmarks: Benchmarking suite added (benchmark/).
  • Documentation: Updates to API docs and feature guides.
  • Testing: Expanded test coverage for complex features and edge cases.

0.0.1 – 2026-01-01 #

Initial release of TeXpr.

This is a complete rebranding and evolution of the legacy latex_math_evaluator project. It serves as a engine for parsing, evaluating, and analyzing LaTeX math expressions.

✨ Features #

  • Core Parsing:

  • Full recursive descent parser for standard mathematical LaTeX.

  • Generates a structured Abstract Syntax Tree.

  • Supports implicit multiplication, variable binding, and custom functions.

  • Evaluation Engine:

    • Numeric: Arithmetic, Trig, Log, Roots, Factorials.
    • Complex Numbers: Full support for i, Euler's identity, and complex transcendental functions.
    • Matrix: Determinants, Inverses, Transposition, and basic arithmetic.
    • Calculus: Numerical integration (Simpson's Rule) and Symbolic differentiation (Product/Chain rules).
  • Interop & Export:

    • JSON: Export AST to JSON for external tooling.
    • MathML (Alpha): Export to standard web-compatible MathML.
    • SymPy (Alpha): Generate Python/SymPy code from Dart objects.
  • Advanced Features:

    • Optimization: Multi-layer caching (L1-L4) with LRU/LFU policies.
    • Analysis: Piecewise differentiation and symbolic simplification.
    • Diagnostics: Levenshtein-based suggestions for syntax errors.

(Note: This project builds upon 1,800+ tests and architecture from the deprecated latex_math_evaluator v0.2.0)

4
likes
160
points
108
downloads

Publisher

verified publisherandka.id

Weekly Downloads

A Dart library for parsing, evaluating, and analyzing mathematical expressions in LaTeX. Supports symbolic calculus, matrices, and complex numbers.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

web

More

Packages that depend on texpr