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.

Thanks,
Aditya

-- 
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/127b3a9a-0109-4488-9660-e5201312dd55%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to