[Kst] New parser nodes

George Staikos staikos at kde.org
Thu Apr 1 19:13:44 CEST 2004


  I don't like the idea of returning a boolean in a double as is done in the 
new parser nodes for comparisons.  I think we need a better solution - 
nothing big, just something different.  We could predefine EPARSETRUE and 
EPARSEFALSE as special double sentinels - 0.0 and 1.0 would probably work and 
be available everywhere.  While we can easily set EPARSEFALSE to 0.0 and then 
test for EPARSETRUE by "value() != EPARSEFALSE", having EPARSETRUE is 
convenient, and if we have it, it would be nice if the value wouldn't change 
depending on which FPU we happen to be using.  The other idea I had was to 
make an "isBoolean()" function which boolean operators could overload to 
"true".

   This opens up two new possiblities though:

   x > 5*(y > z)

   Should this be considered legitimate?  It could even be of value in 
equations...  If that happens, then we can basically merge all the exparse.y 
rules into eparse.y.

   The equation interpreter could even become more powerful yet in two ways:
1) inline assignment  (allows sequences)
	ex: a := x^2 + a^2
               a would have to start at 0 to make sense unless it's a 
"scalar".  therefore the would compute:
x	a	f(x)	a'
0.0	0.0	0.0	0.0
1.0	0.0	1.0	1.0
2.0	1.0	5.0	5.0
3.0	5.0	34.0 ........

Assignments could be inline too:
	foo + someterm * (a := sin(a + x)) + bar

2) I brought it up before, but some basic calculus can be added.  The 
foundation for symbolic differentiation is basically there.  The value added 
with this is of course not huge because there is already software to do it, 
but at least it does it inline.

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



More information about the Kst mailing list