[Kst] New equation parser and interpreter

George Staikos staikos at kde.org
Fri Feb 13 00:12:34 CET 2004

On Thursday 12 February 2004 18:02, Barth Netterfield wrote:
> Cool...
> What did you do?

  I rewrote it from scratch. :-)  It uses a parser and scanner written in yacc 
and flex, and "compiles" the equation into a tree.  Then you take the root 
node of the tree and call ->value(&ctx), which recursively evaluates the 
equation.  This means that parsing of anything in the equation only ever 
happens once, and we can even optimize it later (constant folding, 
factorization, etc)

   Actually there are faster constructs yet, but I don't think it's worth the 
bigger effort and more complex code it results in.  I need to finish adding 
functions, constants, and a few other minor items and I can switch 
KstEquationCurve over completely.

   I have a long list of other items (not related to KstEquation) that need to 
be dealt with too.  I'm going through them quickly, but some are very complex 
and we need to discuss.  Actually threading is looking to be a requirement 
now.  After experimenting with the event loop in Kst this week, I have found 
a very large number of ways to crash Kst.  I don't think there's much we can 
do about it without moving things over to a threading model (and adding 
locks).  It might be worthwhile to have a second stab at the threading branch 
and trying to optimize it.

    Did you try out the javascript extension?  You need KDE 3.2, but it's 
quite cool. :-)  I'm just waiting for a particularly complex fix from the 
KJSEmbed author and the changes will become very visible.

George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/

More information about the Kst mailing list