ILCalc

A small library for parsing and evaluating arithmetical expressions defined by strings
Download

ILCalc Ranking & Summary

Advertisement

  • Rating:
  • License:
  • LGPL
  • Publisher Name:
  • Pelmen64
  • Operating Systems:
  • Windows All
  • File Size:
  • 108 KB

ILCalc Tags


ILCalc Description

The ILCalc was developed to be a small library for parsing and evaluating arithmetical expressions defined by strings. Performance: Very fast parsing, no need for building any expression trees; No parser generators used, own clearly written parser provided; Ability to validate expression syntax without doing any other work; Strongly-typed expressions - no need for boxing/unboxing values; Flexibility: Choose between interpretation / runtime MSIL generation; Best solutions for all usage scenarios, depending on needed evaluates count: Once - use quick interpretation mode (parse and evaluate by one pass); Many - create Interpret object and use it with different arguments, no re-parse; Much many - create Evaluator object (dynamic codegen - slow startup, fastest evaluation); Many in some argument range - compile Tabulator object (one virtual call per range); Evaluator and Tabulator objects: Thread-safe - may be easily used in multi-threaded scenarios; Compiled methods are garbage-collected and independent from the expression's context. Fastest tabulation possible - specialized method compiling for only one virtual call per range. Interpret object: Independent from expression's context, that may be collected by GC when no longer used; No memory allocations per evaluation (excepting when BCL performs call via reflection); Replaces some calls via reflection with the delegates calls; Optimizer modes: Constants folding: 2^8 + x/(6+3+x) became 256 + x/(9+x); Functions folding: 2x * sin(pi/6) became 2x * 0.5 (beware of side-effects); Pow optimization: x^4 became x*x*x*x, witch is much faster to evaluate; Customizability: Parameterize expressions by using user-defined arguments list; Use constants from user-defined list (like pi, e, inf) in expressions; Import public static functions from any other .NET type into context; Culture-sensitive parsing (number format, string compare, decimal and arguments separators); Or may doesn't use any CultureInfo for more performance parsing (ordinal mode); There is easy way to import built-in constants and functions; Optional case-sensitive mode for identifiers; Optional arithmetic overflow checks; Other: TabRange class for representing ranges of values with handy features; SyntaxException class provides detailed information about syntax errors; All library string resources may be easily localized;


ILCalc Related Software