Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
This would be interesting to discuss in a chat room, but seems too broad and open-ended for a question on MMA.SE. – m_goldberg Dec 1 '12 at 5:33
@m_goldberg, I've trimmed my question. It's about as specific as I feel I can make it now. – jrajav Dec 1 '12 at 5:49
@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. – m_goldberg Dec 1 '12 at 6:02
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 :) – Jacob Akkerboom Apr 18 '13 at 12:49
up vote 20 down vote accepted

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.

share|improve this answer
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. – m_goldberg Dec 2 '12 at 1:51
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. – Todd Allen Dec 3 '12 at 1:08
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 ;-) – halirutan Dec 3 '12 at 16:39
@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 :) – Leonid Shifrin Dec 3 '12 at 16:59
I bought my copy in 1997, just after I got Mathematica 3. I bought it because I was a programmer by trade, and it was advertised as written for programmers rather than mathematicians, scientists, or engineers. Wagner promised a second volume on the FrontEnd but it never appeared. For a long time I kept up hope that it would -- because this book was so good -- but it never did. – m_goldberg Dec 3 '12 at 17:53

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 and for more inspiration from high-level languages, or 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...

share|improve this answer

for a clear explanation of how the Mathematica (aka Wolfram) programming language works, see it is available as both a pdf and as a Mathematica notebook.

share|improve this answer
This is a great resource, thanks a lot! Not sure how I haven't stumbled on this before. – jrajav Apr 18 '13 at 22:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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