28
$\begingroup$

I'm interested in Mathematica's core language for both practical development and as an object of computer science study. Actually, the former is more of a means to the latter. I would like to create complete applications, but mainly to get experience and ideas for creating my own language. I have many ideas for it already, and one of them is to explore Mathematica's unique M-expression syntax, rule-based programming, and other interesting semantics. To this end, I have two questions:

  1. Is the language specification available anywhere? And are there any particularly significant resources on Mathematica as a language?

  2. Are there any legal restrictions on applications created and/or compiled with Mathematica, and if so, do they differ between offerings?

$\endgroup$
7
  • 1
  • 2
    $\begingroup$ This would be interesting to discuss in a chat room, but seems too broad and open-ended for a question on MMA.SE. $\endgroup$
    – m_goldberg
    Dec 1, 2012 at 5:33
  • $\begingroup$ @m_goldberg, I've trimmed my question. It's about as specific as I feel I can make it now. $\endgroup$
    – jonvuri
    Dec 1, 2012 at 5:49
  • $\begingroup$ @Kiyura. It's much better with the edit. Per sub-question 1, AFAIK there is no current language specification publicly available. Per 2, I believe there are legal restrictions -- best read your license agreement. $\endgroup$
    – m_goldberg
    Dec 1, 2012 at 6:02
  • 1
    $\begingroup$ I find your question about applications created with Mathematica confusing. I gathered from Leonids book that applications made by Mathematica (in its own language of course) can only be run by Mathematica, which make them not really (standalone) applications. I see Leonid has already been here, but I'll be bold: This is the relevant section of Leonids book (search for executable). Leonids book deserves to be linked anyway :) $\endgroup$ Apr 18, 2013 at 12:49

3 Answers 3

22
$\begingroup$

The book Power Programming With Mathematica: The Kernel by David B. Wagner, McGraw-Hill, 1996, which proudly announces on its cover that it covers Mathematica 3, devotes Chapter 7 to expression evaluation. Although long out of print, it is the only publication I know of that gives a step-by-step description of how the Mathematica Kernel does its evaluation.

I'm sure the Kernel has changed a lot since Mathematica 3, but Wagner's discussion of the basics of expression evaluation might still be relevant.

Luckily the book can be obtained here.

$\endgroup$
7
  • $\begingroup$ Having the book available on-line as a downloadable PDF would be great. Unfortunately, some publishers don't see the value of doing this with their out-of-prnt titles and that seems to be the case here. $\endgroup$
    – m_goldberg
    Dec 2, 2012 at 1:51
  • $\begingroup$ Has anyone ever contacted McGraw-Hill to see if there is a mechanism in place to allow access to this text? I have often thought how nice it would be to have a copy, but none are to be had at this point. $\endgroup$
    – Todd Allen
    Dec 3, 2012 at 1:08
  • $\begingroup$ I can only tell, that it took me about a half year to find the book through a reseller. I have to say, it is one of my favorites. Back then, I even contacted the author but never got an reply. Therefore, I was checking every week and one day there was reseller on amazon. Lucky me ;-) $\endgroup$
    – halirutan
    Dec 3, 2012 at 16:39
  • $\begingroup$ @halirutan I tried to trace what happened to the author but did not succeed. Apparenty, he quit the Mathematica community very abruptly. Either he is not among the living (which I would not like to think), or something else happened which prompted him to quit. In any case, I was very lucky with the book, since I bought it from Amazon for 40 bucks back in 2004, when I just started programming in M (I started using M in 1997, but before 2004 I was only programming in it procedurally and rather occasionally). So, at the time I had no idea what I was buying - it was a pretty random purchase :) $\endgroup$ Dec 3, 2012 at 16:59
  • 2
    $\begingroup$ Because of this discussion, I picked the book and began reading it again and running some the code on my iMac. One shock -- my two year old i7 iMac is 125 times faster than the Power PC Macintosh used by Wagner when he was writing the book. $\endgroup$
    – m_goldberg
    Dec 5, 2012 at 1:18
13
$\begingroup$

I think the best source would be the "core" section of the Mathematica built-in documentation. I have seen also people interested in Mathematica's semantics and power in discussion groups like Haskell, O'Caml and others.

IMHO all answers point to a simple rewrite model (as also said in the docu), for which, of course, Mathematica has its own flavour. As mentioned in the comments, it is likely that lots of those specific ideas in Mathematica are protected by Wolfram's copyright. But rewriting as a general programming/semantic model is not novel. I encourage you to visit http://haskell.org and http://clean.cs.ru.nl/ for more inspiration from high-level languages, or http://www.forth.org/ for the same in low-level programming.

Anyway, at the end, keep in mind that probably you may be able to implement Mathematica's basic rewrite model as described in the "core" part of the documentation in few weeks (I said it because I have read people claiming this,) but much of the power of Mathematica comes from the humongous amount of effort poured by Wolfram in the set of built-in rewrite rules, i.e. in what in a traditional programming language like Java or Ruby would be called "libraries" or "API".

Update: here you find the evaluation model/semantics in Mathematica (updated to latest) from Wolfram itself. If you want to understand how built-ins could be implemented see the languages I mentioned above: Clean is a nice example albeit probably too far as it also implements linear types...

$\endgroup$
11
$\begingroup$

for a clear explanation of how the Mathematica (aka Wolfram) programming language works, see http://library.wolfram.com/infocenter/MathSource/5216/ it is available as both a pdf and as a Mathematica notebook.

$\endgroup$
1
  • $\begingroup$ This is a great resource, thanks a lot! Not sure how I haven't stumbled on this before. $\endgroup$
    – jonvuri
    Apr 18, 2013 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.