Comment #5 on issue 2864 by [email protected]: Parsing issue with mathematica.py with regex expressions
http://code.google.com/p/sympy/issues/detail?id=2864

You can use regexes for bottom-up parsing:

a) Use a token-to-subtree dict.
b) Write a regex that recognizes only innermost expressions (i.e. those that do not contain parentheses themselves). Build the bottom nodes as with normal regex-based parsing. c) In the input string, replace the recognized strings with tokens that aren't in the string. Enter the recognized strings in the dict, with the token as key.
d) Repeat from b until the whole string is recognized.
e) Use the dict to build the parse tree.

It's not pretty, it's not efficient, but it's straightforward and a gradual route from regex parsing.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to