Choosing a parser for Mathematica input

David Kirkby <drkirkby@gmail.com>
Sun, 7 Nov 2010 18:26:05 -0800 (PST)

          From comp.compilers

Related articles
Choosing a parser for Mathematica input drkirkby@gmail.com (David Kirkby) (2010-11-07)
Re: Choosing a parser for Mathematica input jthorn@astro.indiana-zebra.edu (Jonathan Thornburg \[remove -animal to reply\]) (2010-11-09)
Re: Choosing a parser for Mathematica input haberg-news@telia.com (Hans Aberg) (2010-11-09)
Re: Choosing a parser for Mathematica input drkirkby@gmail.com (David Kirkby) (2010-11-09)
Re: Choosing a parser for Mathematica input winkzhang@gmail.com (Wink Zhang) (2010-11-13)
Re: Choosing a parser for Mathematica input idbaxter@semdesigns.com (Ira Baxter) (2010-11-26)
Re: Choosing a parser for Mathematica input drkirkby@gmail.com (David Kirkby) (2010-11-26)
[1 later articles]
| List of all articles for this month |

From: David Kirkby <drkirkby@gmail.com>
Newsgroups: comp.compilers
Date: Sun, 7 Nov 2010 18:26:05 -0800 (PST)
Organization: Compilers Central
Keywords: parse, question
Posted-Date: 09 Nov 2010 01:58:08 EST

I'd like to write a program that uses a Mathematica-like syntax. Not a
100% clone, but as close to Mathematica input as reasonably practical.
Can anyone suggest a suitable front end parser? I was thinking of
using LLVM for the back end.


Here's a description of the syntax


http://reference.wolfram.com/mathematica/guide/Syntax.html
http://reference.wolfram.com/mathematica/tutorial/TheSyntaxOfTheMathematicaLanguage.html


Things to note in particular is that whitespace can often mean
multiplication. i.e.


In[1]:= 12.1 2


Out[1]= 24.2


Mathematica supports many programming styles - procedule, functional
and rule-based programming


A Lisp to Mathematica translator was written by Prof Fateman


http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.51.4310&rep=rep1&type=pdf


In the paper Fateman says the language appears to be ad-hoc, so he had
limited success with a common parser and used a hand-written one. But
I'm not entirely convinced of his objectivity - he tends to mock the
creators of Mathematica - his program is called MockMMA. He was one of
the creators of a computer algebra system Maxima, which he always
compares favorably to Mathematica, though few others do,


I've never written a compiler, beyond noddy calculators in
introductory books, so I suspect this language is not an ideal one to
learn with. But I'd be interested in what, if any tools would be
capable of handling such a complex language,


Dave



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.