Wednesday, February 27, 2008

Lack of BNF Grammar for Mumps

In my quest to find a document generator for mumps, I've found that there's nothing really built for it. Doxygen looks great, but only supports C/C++ style languages. The Doxygen faq says to use an input transform (their term, not fileman!) to translate your language into a C style. So I figure well, if I gotta do that, might as well write my own parser. So the logical place is to start with a grammar. But guess what? There is no BNF grammar for mumps to be found. Supposedly it's part of the ANSI and ISO standards, both of which you have to pay to receive a copy of. Through my searching, I've discovered that supposedly the MDC decided to keep all non-ansi/iso copies of the mumps BNF grammar on paper only, no electronic form available. Other people that have asked for the grammar have been told to look at a vendor specific implementation, and infer the grammar from that. Great.


  1. I have been searching for Mumps BNF for long, did not find one? did you try to write a BNF on your own? were you able to find a parser for MUMPS?

    If we have BNF we can generate a parser from various open frameworks.

  2. Unfortunately, I haven't found any copies, and apparently no one else has either. It seems like the BNF grammar for mumps is some big secret. Apparently since it is an ANSI standard, anyone can get a copy, but you have to pay ANSI to get it. For now, I've stopped searching for the grammar, but if you find one, please let me know!

  3. I don't know if this is something you are still interested in. The M standard grammar has been available for years at, where it is scattered over several pages (the website is one that comments on each part of the standard). It is not really in a form that most compiler-compilers use, like yacc or pccts.

    The MUMPS grammar is rather simple if you don't check the syntax at run-time. I worked up a mumps.g file several years ago, which I think is on the internet for yacc, but it didn't do the run-time checks. I can look for a copy if you still are interested.

    I'm David Whitten, and my phone # is 713-870-3834

    1. For the record, I'd be interested in taking a look at the yacc grammar, if you dug it up. Do you have a github account?

  4. MUMPS was originally documented using TDL for transition diagrams, rather than BNF for syntax diagrams. That makes BNF hard to find.
    The annotated MUMPS standard ( has a section devoted to MUMPS transition diagrams. You actually need to search the page for the word "diagram" and repeatedly hit the little 'right-pointing hand' to get to the actual diagrams, but they're there.
    The problem is that transition diagrams are instructions about how to *parse* a syntactically correct corpus of the language; whereas syntax how to *construct* a syntactically correct corpus. So if you're building a MUMPS parser, transition diagrams are helpful; if you're learning the language, they suck.


Note: Only a member of this blog may post a comment.