Alexandre,

Try JediMath. It has a unit named Symbolic which is written by Marco van der Voort. The same unit is also on the FPC SVN available, I can't find it at the moment, but it's there (with example). If you need specific help here, just ask.

Darius

----- Original Message ----- From: "Alexandre Leclerc" <[EMAIL PROTECTED]>
To: "lazarus mailinglist" <[email protected]>
Sent: Friday, June 09, 2006 4:31 PM
Subject: [lazarus] Looking for an expression evaluator


Hi all,

I'm looking for an expression evaluator that is able of the following
(and works under fpc - I tried TExpressionParser from Egbert van Nes
but even if it compiles, it doesn't works... unless this is me not
using it properly):

//this is a pseudo example of the functionnality I'm looking for:
ExpressionParser.AddVariable('Var1 := 2 + 2');
ExpressionParser.AddVariable('Var2 := (2 * 2) / 2');
ExpressionParser.AddVariable('Total := Var1 + Var2 + MyFunction(2,3,4)');
ExpressionParser.AddFunction('MyFunction', 3); //number of parameters
result := ExpressionParser.GetResult('Var2');
result := ExpressionParser.GetResult('Total');

ExpressionParser.OnFunction(const functName: string; var: array of
string; var result: string);
begin
 result := '0';
 if functName = 'MyFunction' then
   result := '5'; //could process the variables...
end;


Regards.

--
Alexandre Leclerc

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to