The problem is that the regular schedule should pull out the first match with a pair of brackets. That is, according to the logic of the program, it should pull out of this expression
0:SIN(20 + 20) 1:20+20
Or another example:
SIN(20) + SIN(SIN(30) - SIN(40))
should pull out:
0:SIN(20) 1:20
And from
SIN(20 - SIN(40))
should pull out:
0:SIN(40) 1:40
C #, .NET 4.0!