Has anyone given thought for making Sage read Mathematica syntax? I've
seen a recent video from William stating it is NOT an aim of Sage to
be clone of any of the 4 M's - in contrast, Octave is a clone of
MATLAB.

Whilst parsing Mathematica code is not an aim of Sage, I doubt many
would are argue that it would be a useful addition if Sage could read
Mathematica code, and do something useful with it.

I could see several way one might attack such a problem.

1)) Use yacc/lex to create a C library, then call that from Sage.
2) Write the parser in Python.
3) Pass the input directly to ECL (Lisp interpreter) and do the
parsing in Lisp.

Personally I'd be most comfortable in using lex/yacc/C, less
comfortable in Python and even less so in Lisp, as I don't have a clue
about Lisp.

But actually, the latter approach, using Lisp, which personally I'd be
*least* comfortable with, might actually be the *most* sensible
approach. Why?

1) Most computer algebra systems are based on some form of Lisp -
including Mathematica I believe, so it can't be a bad choice.

One might even argue Lisp might have been a better choice than Python
than Sage, though there are far more Python programmers than Lisp
programmers, so that's possibly not true. In fact, I think it's fair
to sage having Python skills on ones CV is more worthwhile than Lisp
skills.

(flames for even considering not using Python to /dev/null).

2) I think there's a library interface to ECL, which could probably
avoid the need for messing around with pexpect. Send the input
directly to ECL.

3) There is also a paper describing a Mathematica parser in Lisp in a
peer reviewed journal.

http://portal.acm.org/citation.cfm?id=1089419.1089421

For those of us not affiliated with an academic institution and so
have no access to a library (boy, do I miss that), a paper by the same
name at

http://www.eecs.berkeley.edu/~fateman/papers/lmath.ps

is probably almost identical

4) The source code for that Mathematica parser is available.

http://www.cs.berkeley.edu/~fateman/mma1.6/

whilst most obviously written for an old version of Mathematica, a few
source files were updated in 2006, suggesting it probably works with
semi-recent versions of Mathematica. In any case, Mathematica is
reasonably backwards compatible.

5) The author of the Mathematica parser in Lisp is alive and kicking,
and a reader of sage-devel.

Getting Sage to read Mathematica and do useful things with it, should
make an interesting project for a computer science student. Although I
don't know much about this, I would be guess this would have to be an
MSc project, not an undergraduate one as I doubt doing any of this
would be trivial.

Once such a parser existed which was usable from Sage, a mathematician
could probably do useful things with it.

Of course, I'm aware Sage has an interface to Mathematica, but that
needs a Mathematica license to be of any use at all.

Realistically, in my personal opinion, Sage will never have the
combined functionality of MATLAB, Maple and Mathematica. In fact, I
don't believe it will ever have the full functionality of any of those
3. (I also accept that Sage is far ahead of Mathematica in some areas
such as number theory). On that basis, there's little point in
worrying about a 100% complete implemention of a Mathematica parser.

Has anyone got any comments?

Dave

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to