TbcParser class


Properties                Methods                Events                

Top  Previous  Next







TbcParser = class ( TComponent )






This mathematical expression parser component parses and evaluates a mathematical expression that may contain variables and functions.


Examples to typical expressions are:




'( [ SIN(X)^2 ] + COS(1) ) * PI/2'


'( COSH(2.71)+ SINH( COS(0.5) * POW(0.2345, 0.67) )) - LOG(1-X^2+X^5)'




'25993.894*EXP(-1.53389*(X-32))*POW(X, 0.13547)*POW(Y, 0.38603)*EXP(-0.36222*Y)'




The user can add/remove his/her own custom variables and functions to be used in the expression. To be efficient in repeated calculations, parser creates a parse tree at first and reuses this parse tree for each evaluation without the need to reparse.


If Optimization is on, the parse tree will be optimized by calculating constant expression sections at once so that further evaluation requests will be quicker.