On 26 February 2011 04:32, rjf <fate...@gmail.com> wrote: > > > On Feb 25, 4:28 pm, David Kirkby <david.kir...@onetel.net> wrote: > >> Of course, creating the BNF is a non-trivial task, but it seems the >> descriptions of most languages don't actually include a BNF. > > I think you can find a formal grammar for almost every computer > programming language except for Mathematica, which presumably has > a grammar but it is secret. > > Look at it this way: > with such a formal description it is relatively easy to write a > parser, and to be assured that the parser corresponds to the grammar, > which a computer scientist would use to help design a language. Most > people would run the grammar through a parser generator and eliminate > constructions that are not consistent with the needs of the parser > generator. It cleans up ambiguities, among other things. > > Since you were planning to write a parser, why not write > the grammar first...
I was hoping someone might have done it, as the task seems non-trivial. Did you write one for MockMMA, and if so are you willing to share it? > I would have expected that in your perusal of compiler books you > would get this idea. Yes, I did, though geting it from reading the Mathematica docs is a lot more difficult than generating one for a language one chose to design oneself. >> Perhaps >> one can be found for C, but it's not in K&R book. > > C Programming Language (2nd Edition) (Paperback) > by Brian W. Kernighan, Dennis M. Ritchie > page 234 et seq I overlooked that. Thank you for the correction. Dave -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org