Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1514

Re: Choosing a parser for Mathematica input

From Robert Jacobson <rljacobson@gmail.com>
Newsgroups comp.compilers
Subject Re: Choosing a parser for Mathematica input
Date 2015-02-06 19:04 -0800
Organization Compilers Central
Message-ID <15-02-012@comp.compilers> (permalink)
References <10-11-017@comp.compilers> <15-02-009@comp.compilers>

Show all headers | View raw


I am among those who are trying to write a Mathematica parser. There are a few
Mathematica parsers out there.

* Richard Fateman's old MockMMA of course (written in Lisp) which is mentioned
in the first post of this thread from 2010.

* This MIT-licensed parser written in Scala is notable. Written by Mateusz
Paprocki "and contributors" a couple of years ago.
https://github.com/mattpap/mathematica-parser

* Alex Gittens's basicCAS is a python Mathematica parser, but it appears to
have disappeared from the author's website. It's still available elsewhere on
the net for those interested in looking for it. This project is interesting
because it includes Alex's notes regarding implementation.
https://pypi.python.org/pypi/basicCAS/1.0

* Mathics, a Mathematica clone written in Python and created by Jan Pvschko,
is particularly interesting. You can use it online. GPL licensed, copyright
2007.
http://www.mathics.org

* omath is similar in spirit to Mathics but is written in Java and appears to
have been abandoned at version 10^(-16) in 2005. The parser is a generated
parser using JavaCC and JJTree. The source code is distributed without a
license.
http://omath.org/w/index.php?title=Main_Page

* symja contains a Mathematica parser for a reasonable subset of Mathematica.
https://code.google.com/p/symja/source/browse/#svn/trunk/matheclipse-parser

SymPy and Sage both have rudimentary Mathematica parsers that work for basic
mathematical expressions. There are also some (rumors of) proprietary
Mathematica parsers. John Herrop of Flying Frog Consultancy claims to have
written a Mathematica parser in 300 lines of OCaml under contract for Wolfram
Research. The code is obviously not publicly available. Semantic Designs, a
company specializing in compiler technologies, lists Mathematica among the
many languages for which it has "front ends." (Both mentioned here:
http://stackoverflow.com/questions/1608380/parser-for-the-mathematica-syntax.
)

Wolfram Research may be grotesquely litigious, but given the existence of so
many of these projects it seems to me they are no longer interested in suing
everyone who even thinks the word Mathematica as they once were.

My own project is to construct an ANTLR4 grammar for Mathematica. Such a
grammar seems to me to be the easiest way to benefit the most people with
current compiler technologies. ANTLR4 has c#, python, java, and javascript
targets (some better than others), and a c/c++ target is allegedly in the
works. Several projects have expressed interest in such a thing, but it
appears nobody has succeeded in producing it. I am very happy with how far I
was able to get with very little effort, but my grammar isn't yet ready for
public consumption (read: doesn't work). See my top-level post to this
community for an example of one of the problems I'm still trying to solve with
my project.

Best,

Robert

Back to comp.compilers | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Choosing a parser for Mathematica input fateman@gmail.com - 2015-02-05 08:08 -0800
  parsability (was: Choosing a parser for Mathematica input) glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-06 00:05 +0000
    Re: parsability and human factors "Derek M. Jones" <derek@_NOSPAM_knosof.co.uk> - 2015-02-07 12:45 +0000
      Re: parsability and human factors glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-08 10:32 +0000
        Re: parsability and human factors "Derek M. Jones" <derek@_NOSPAM_knosof.co.uk> - 2015-02-10 12:44 +0000
    Re: parsability "Robin Vowels" <robin51@dodo.com.au> - 2015-02-09 00:48 +1100
      Re: parsability Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2015-02-08 20:49 +0100
        Re: parsability news@iecc.com (News Subsystem) - 2015-02-09 14:37 +1100
  Re: Choosing a parser for Mathematica input Robert Jacobson <rljacobson@gmail.com> - 2015-02-06 19:04 -0800

csiph-web