Hi list, I'm currently working on a program to parse LaTeX style maths expressions and provide an answer. For example, I have the expression "2^\frac{1}{2}". I'm trying to work out a way to split this into it's most basic blocks of LaTeX (i.e. 2^ and \frac{1}{2}) while maintaining a record of the depth of the expression (i.e. (2^,0),(\frac{1}{2},1)). I will then process this list from the highest order downwards, feeding the deeper results progressively into shallower elements until all have been calculated. LaTeX allows me to legally express the previously stated expression as "{2^{\\frac{1}{2}}}". This makes it much easier to figure out where the units of LaTeX are located. The depth of any item can now be expressed as the number of unpaired opening or closing braces between the element and the start or end of the expression. I'm essentially looking for a way to split the string up along the braces, while recording the number of braces between the split and either end of the expression.
Any help would be much appreciated. Cheers, Dan
pgpLJN6CxlI0r.pgp
Description: PGP signature
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor