On Sep 2, 2:23 pm, "Dr. David Kirkby" <david.kir...@onetel.net> wrote: > On 09/ 2/10 06:10 AM, rjf wrote: > > > > > the mathematica syntax parser that I wrote appears to run inside > > Maxima, so > > you can, if you wish, feed such text to the mma-in-maxima system. > > Sorry to sound green, but I barely know Maxima, and do not know Lisp at all. > > I do know Mathematica - though I'm certainly not at expert at it. > > There's no README file in the source code I found of yours, so it's far from > obvious to me how I would use it. um, I don't know where you looked, but
here is one place.. http://www.cs.berkeley.edu/~fateman/mma1.6/ I forget exactly, but I think it is approximately, get all those files in that directory. start a lisp in that directory. (load "capsonlyparser.lisp") (in-package :mma) (p) then type some mathematica and hit two returns. Better lisps that don't do everything in caps would use the regular parser file, which is easier to read and modify. > > Are there any differences between the paper I found on your web site, and the > paper published in a peer reviewed journal? probably not > > Certainly from reading the paper, it gives no indication that this runs as > part > of Maxima. Right. The adaptation was the work of someone else to load it into Maxima. Check sourceforge. John Lapeyre was the author. It gives the impression to me that this is written in lisp, to run > under the lisp interpreter directly - not under Maxima. I'm a bit confused on > this issue. My program can run without Maxima. > > > The intent in that project is mainly to take mma syntax for > > expressions and map it into > > maxima, and not take the big step of having a more-or-less full > > mathematica > > evaluator in Maxima. > > How complex in your opinion would it be to create a parser for Mathematica in > C/C++/Python/Lisp/whaterver-is-most-suitable which could call the right part > of > Sage for a particular tasks? In other words, call Maxima for integration, > perhaps the GSL for Bessel functions, etc. Well, if you want to load GSL or whatever into lisp, then you can use the parser that is already in Lisp. As for a "whatever is most suitable" to create a parser for Mathematica, that would have to be Mathematica, since it is already done. If you want an #2, I would say Lisp. > > I realise a complete parser would be impossible due to the fact Sage simply > does > not have all the functionality of Mathematica. You could still have a complete parser.You would not have an evaluator that was complete. > > I'm pretty sure this is a non-trivial project, but my background is > engineering, > not maths or computer science, so I don't have a lot of understanding of the > complexity involved. > > I just bought a book on Lex + Yacc (around the US equivalent of $1 used). I've > no idea if they would be suitable tools or not, but at 1$ I'm not going to go > bankrupt. Unfortunately, WRI does not give you a context free grammar for Mathematica, nor does it give you a description of the tokens that you can use. So Lex and Yacc are not directly applicable. > > I gather there are several types of parser LL, LR etc. I've no idea what type > is > best for parsing Mathematica. Since Mathematica's language is not a context free language, as far as I can tell, none of these abstract classes of parsers will entirely work. There are constructs in Mathematica that appear to require ad hoc parsing techniques. Though much of it can be done by some kind of table-driven parser, e.g. LALR or LL. The MockMMA lexer and parser are modified from a recursive descent parser with variable look-ahead. My suggestion is that you find someone who knows lisp, or is willing to learn it, and then use the parser, free. or I suppose you could have someone write a parser in Python, but then you'd might have to write a substantial portion of Lisp, too, for the representation and manipulation of the intermediate expressions. So Lisp turns out to be a pretty substantial win. RJF -- 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