Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Robert Jacobson Newsgroups: comp.compilers Subject: Re: Choosing a parser for Mathematica input Date: Fri, 6 Feb 2015 19:04:08 -0800 (PST) Organization: Compilers Central Lines: 58 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <15-02-012@comp.compilers> References: <10-11-017@comp.compilers> <15-02-009@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: miucha.iecc.com 1423278971 53225 2001:470:1f07:1126:0:676f:7373:6970 (7 Feb 2015 03:16:11 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Sat, 7 Feb 2015 03:16:11 +0000 (UTC) Keywords: parse Posted-Date: 06 Feb 2015 22:16:11 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1514 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