@Szbalocs has answered the syntax question. I'd like to say more about a formal specification for Wolfram Language.
Formal Specification of Wolfram Language
There is no official formal specification from Wolfram. I have a project to create a formal specification for Wolfram Language that I invite anyone and everyone to participate in. You will see that the specification is only in the earliest stages of being written, but there has been significant work by me and others to investigate the behavior of Wolfram Language in its various implementations, much of which is documented here on SE.
Progress So Far
The most complete part of the specification effort is for number representations, but only a few days ago we discovered a couple of edge cases with number forms that have yet to be pushed to the GitHub repo—or published anywhere else.
Significantly, I have cataloged every Wolfram Language operator along with the arity, associativity, precedence, and other information. This information has been unavailable prior to its publication in the repository.
I envision the WLTools GitHub organization as a central repository for resources than can be shared across Wolfram Language Projects. Beyond a language spec, I plan on creating a machine readable repository of test cases. Many of us already maintain our own corpus of tests. We would all benefit from a test suite that covers each of the corner cases all of which no single one of us would have discovered alone.
Challenges of Creating a Formal Specification
I have written about the challenges of creating a formal spec for Wolfram Language in a series of articles—three so far—on my blog. I list only a few:
- There are differences not only between different versions of Mathematica, but also between the notebook interface,
ToExpression, and the command line interface. For example, my operator catalog covers the behavior of the command line and
ToExpression, but I am currently still working on the behavior of the notebook frontend.
- The demarcation problem, which manifests in several ways:
- Sidestepping the philosophical question of, what is a language?, the only source of data for Wolfram Language are implementations with a great many bugs. Does the formal spec fix the bugs? Does the formal spec fix mistakes in design?
- Must Mathematica conform to the formal spec? If the spec allows both
\[Minus] in scientific notation number forms, code conforming to the spec won't evaluate in Mathematica.
Despite the challenges and inevitable disagreements about where any given boundary should be set, I obviously still think it is a worthwhile endeavor. An imperfect spec is better than the pile of nothing we currently have.
Resources for Wolfram Language Implementors
Since none explicitly mentioned they are writing a parser, here are some resources that will make your work a lot easier:
- The unofficial spec, obviously.
- Other Wolfram Language projects and their developer communities.
- The Wolfram Language Slack Workspace (public invite link) which hosts many brilliant, incredibly knowledgable developers of Wolfram Language tools. We discuss implementation challenges and questions, share resources, and generally have interesting conversations about the technical aspects of Wolfram Language. We have a lot of advice for someone who is just setting out to write a Wolfram Language parser.