On Wed, Mar 5, 2014 at 12:09 AM, Aditya Shah <[email protected]> wrote: > I have developed a raw block diagram and an API to explain my concept. It > goes as follows: > > Suppose, we want to write a parser for the MathML Language. We need to > create 2 things: > > 1. A Spec File (this contains the mappings between MathML features and > corresponding sympy features (although not all)). > 2. A Parser Generator File (This file contains references to the Spec File > and the Parser Generator Framework(PGF)(which I intend to create). > > Spec File ==> Parser Generator Program <== Parser Generator Framework(PGF) > || > V > <Name of language>.py + Entry updated in the > parsers.py file > > On executing this Parser generator file, for our example we get a parser > program called mathml.py > > This file is placed in the sympy/sympy/parsing/parsers folder. > > A file exists in /sympy/sympy/parsing/ called parsers.py which contains the > mappings of name of languages and corresponding parsers found in the > ./parsers/ folder. > > So we also update the code in the parsers.py to include the mathml language > parser. > > Now a user who wants to convert a MathML string to its sympy equivalent, > does the following steps: > a = parsers.convert_sympy(s, lang='mathml') > This statement invokes a function convert_sympy in the parsers.py which > matches the parser to be invoked as mathml.py. It passes the string s to the > parser mathml.py. After the necessary transformations, it is passed on to > sympify module in sympy/sympy/core/ folder. The final output is returned and > stored in a which is now a pure sympy expression. > > Please provide feedback on this idea and point out any mistakes or > inefficiencies in case you discover any.
For parsing, will this work to create robust parsers for all inputs out there, like Mathematica, MathML, etc? Because each is a completely different language, it's not just creating a simple table of corresponding symbols like ArcSin <-> asin, you have to understand loops and other language specific details of Mathematica, and those are unique for each language. As to natural processing, if you have experience in it, feel free to draft a proposal, so that we can discuss particular details. Ondrej -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CADDwiVBB9rMiKN8JBXHOZ5Jj2JeS0H-Vj1GwuAJGhMj1uzJobg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
