Am 07.03.2014 12:47, schrieb Aditya Shah:
@Jo Thanks a lot! The last post cleared all things up. So basically, I can
enforce a standardized grammar and implement that used the likes of
modgrammar library which I think is quite convenient and suitable for the
task. I need to define the rules of the grammar and in such a way that any
language can then be extended very simply via the development of a simple
interface that converts the rules of that language to the standard set. Is
that feasible now?

Assuming that modgrammar allows what you want to do, I guess yes.

Given that modgrammar is built to accept grammar rules via Python code, I guess you'd build the grammars for the various dialects (Mathematica, MathML etc.) from function calls, and factor out what can be factored out across grammars.

The main point would be that you consider cases like
a) What if one dialect adds a new operator with a priority between, say, + and *? b) What if one dialect adds a new feature, e.g. an ellipsis token ('...') to indicate a range? c) What if one dialect adds something whacky, such as (a...b( to indicate a range from A (included) to B (excluded)? Such a grammar would doubtlessly be highly ambiguous, but anyway.

I wrote "consider" - i.e. I do not think these should be implemented, but your work will stand the test of time better if you imagine somebody asking you about how to implement such a change and you don't want to say "sorry, you need to redo it all for that".

A GLR parser should allow arbitrary grammar rules, even ambiguous one, so I do believe that modgrammar (being a GLR parser) should fit the bill. It might still fail due to implementation limitations or some other devil in the detail, so we won't be sure about that before somebody tries.

HTH
Jo

--
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/5319C1BD.5040303%40durchholz.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to