Re: [Tutor] token parser

2007-02-11 Thread Eike Welk
A nice parsing library is pyparsing: http://pyparsing.wikispaces.com/ It contains a parser for mathematical expressions. There are examples in the source distribution. HTH, Eike. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/li

Re: [Tutor] token parser

2007-02-11 Thread Kent Johnson
Dj Gilcrease wrote: > How would I go about writing a fast token parser to parse a string like > "[4d6.takeHighest(3)+(2d6*3)-5.5]" > > and get a list like > ['+', > ['takeHighest', > ['d', > 4, > 6 > ], > 3 > ], > ['-', > ['*', >

[Tutor] token parser

2007-02-11 Thread Dj Gilcrease
How would I go about writing a fast token parser to parse a string like "[4d6.takeHighest(3)+(2d6*3)-5.5]" and get a list like ['+', ['takeHighest', ['d', 4, 6 ], 3 ], ['-', ['*', ['d', 2,