Re: Again : Is there a BNF for Mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg119788] Re: Again : Is there a BNF for Mathematica?
- From: Richard Fateman <fateman at cs.berkeley.edu>
- Date: Wed, 22 Jun 2011 03:45:19 -0400 (EDT)
References: <irijpq$qf8$1 at smc.vnet.net> On 5/25/2011 2:57 AM, E. Martin-Serrano wrote: ... stuff about parsing ... 1. BNF can be used to describe a context-free language. 2. The Mathematica language is not context free, and thus cannot be described completely in BNF. 3. If you need to parse Mathematica expressions and you have a Mathematica system around, you can simply use it to convert the expressions to FullForm, which is easily re-parsed (and does have a BNF). 4. If you do not have a Mathematica around, there are (free) programs that will parse Mathematica into something equivalent to FullForm. 5. Your ideas about what you would do if you had a BNF for Mathematica seem to conflate syntax with semantics (evaluation) and, so far as I can tell, do not seem to make sense. If you wish to do experiments with programming language transformations, you can easily learn about other programming languages that are (a) well-defined (b) much more popular (c) can be described by BNF (d) are susceptible to transformations into the same language for efficiency or readability or program proofs or other purposes. There is a substantial literature on such subjects. I suspect that Mathematica has little or nothing to add to the discussion, and in my opinion certainly does not have enough value added to compensate for its complexity syntactically or semantically. For example, do you think that you fully understand the matching process at the core of the rule-based transformation system that underlies Mathematica evaluation? Can you really demonstrate that two non-trivial Mathematica "programs" compute the same thing? RJF