TbcParser class

 

Properties                Methods                Events                

Top  Previous  Next

 

 

Unit

bcParser

 

Declaration

TbcParser = class ( TComponent )

 

 

Description

 

 

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

 

Examples to typical expressions are:

 

'SIN(3.14)+5^2+POW(2,7)-MAX(10,20)'

 

'( [ 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)'

 

'(90+292*POW(X,0.31))*(1+0.025*LOG(Y))*(1-1*POW(Y+X,1.09))'

 

'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.