Syntax diagrams for mumps?

65 views
Skip to first unread message

Kevin Toppenberg

unread,
Jan 18, 2025, 8:09:28 PMJan 18
to Everything MUMPS

Does anyone know where I could review a syntax diagram (also call railroad diagram) for the mumps language?

I know that the yottadb programmers guide will provide syntax information for a particular command.  Here is one for "DO"

D[O][:tvexpr] [entryref[(expr|.lvn[,...])][:tvexpr][,...]]


And there is this excellent language reference:
But this doesn't seem to have all the details about allowed syntax.

And the VA's XINDEX code does some analysis, but I don't know the details.

The reason I'm interested is that I've been reading about the Language Server Protocol (LSP), which is a Microsoft solution to abstract how various editors can interact with the LSP to get syntax information.  All the good stuff that IntelliSense provides.   Here is more information about LSP's https://microsoft.github.io/language-server-protocol/

I think it would be cool to have this for mumps.  It would be a very large project, and I'm not sure I'm willing to launch into it.  But one of the first steps, according to chatGPT, is for the LSP code to create an Abstract Syntax Tree (AST).  Essentially, the LSP needs to parse the source code such that it can then rapidly provide code insight across large projects etc. 

So that leads me finally to the idea of parsing mumps code.  I have previously written some code that extracts out functions calls etc to allow tracking code dependencies.  But it would be nicer to have a more accurate parser.

Summary: Any formal syntax parsing tools for mumps?

Thanks
Kevin

ed de moel

unread,
Jan 18, 2025, 8:31:34 PMJan 18
to Everything MUMPS

An attempt for such diagrams was made for the 1977 standard and the 1984 one.
The standards after that got complicated enough that nobody ever completed
new diagrams for those.
The start pages for those diagrams are:

http://71.174.62.16/Demo/AnnoStd?Frame=Main&Page=a10t001&Edition=1977
http://71.174.62.16/Demo/AnnoStd?Frame=Main&Page=a10t001&Edition=1984

Hope this helps,
Ed 

Kevin Toppenberg

unread,
Jan 19, 2025, 7:24:34 AMJan 19
to Everything MUMPS
Ed,

Thank you for your reply.  When I click on the links you gave, I see a discussion of the standards, and links to a bibliography as follows:

Conway, M. E., "Design of a Separable Transition-Diagram Compiler," Communications of the Association for Computing Machinery, 6:7 (July 1963), pp. 396–408.

Conway, M. E., "Preliminary MUMPS Language Specification," MDC 1/3, Draft Proposal, Revised 7/12/74, MUMPS Development Committee. Note 3

Wasserman, A. I. and Sherertz, D. D., "Implementation of the MUMPS Language Standard," MDC 2/3, 6/15/75, MUMPS Development Committee.


Is any of this available online?


Thanks

Kevin

K.S. Bhaskar

unread,
Jan 19, 2025, 2:44:25 PMJan 19
to Everything MUMPS
We started something along these lines a few years ago, but put it on hold. See https://gitlab.com/YottaDB/DB/YDBDoc/-/issues/246

Regards
– Bhaskar

Kevin Toppenberg

unread,
Jan 19, 2025, 6:52:01 PMJan 19
to Everything MUMPS
OK, thanks for letting me know

Kevin

Kevin Toppenberg

unread,
Jan 19, 2025, 6:58:45 PMJan 19
to Everything MUMPS
The entries in the Programmer's guide might be a starting point.

D[O][:tvexpr] [entryref[(expr|.lvn[,...])][:tvexpr][,...]]

I understand that "tvexpr" is a truth-valued-expression
[ ] indicates option parts of the command
,... means the pattern may repeat
entryref, would be like MYTAG+OFFSET^MYROUTINE
but what is "lvn", and what is the signficance of the preceding "." ?

Thanks
Kevin

Kevin Toppenberg

unread,
Jan 19, 2025, 7:07:54 PMJan 19
to Everything MUMPS
I found this entry
K[ILL][:tvexpr] [glvn | (lvn[,...]) | *lname | *lvn ]

From the context, I think

glvn = global variable name
lvn = local variable name
lname = ?? name

KT

Kevin Toppenberg

unread,
Jan 19, 2025, 7:16:22 PMJan 19
to Everything MUMPS
From this:
$G[ET](glvn[,expr])

looks like glvn = global or local variable name.

Are these abbreviations defined anywhere?

Kevin

David Wicksell

unread,
Jan 19, 2025, 7:23:58 PMJan 19
to Everything MUMPS
They're from the M Standard.

David Wicksell
Fourth Watch Software LC

Kevin Toppenberg

unread,
Jan 19, 2025, 8:05:42 PMJan 19
to Everything MUMPS
That helps.  Now if I could only find a document for the M Standard.


Local Variable Name lvn
Global Variable Name gvn
glvn is defined so as to be satisfied by the syntax of either gvn or lvn.


I find:
lname local name,
rgvn restricted global variable name,
rlvn restricted local variable name,
ssvn structured system variable name,
svn special variable name,


I can't find an example of "local name".  Would this be a tag name??

Kevin

David Wicksell

unread,
Jan 19, 2025, 8:11:41 PMJan 19
to Everything MUMPS
Yeah, an __lname__ is just a name, starting with a `%` or one of the __ident__ characters (A-Z and a-z),
followed by a __digit__  or any of the __ident__ characters. So no parens or subscripts, or anything
else, just the name. It's used in several contexts in the standard.

David Wicksell
Fourth Watch Software LC

David Wicksell

unread,
Jan 19, 2025, 8:32:48 PMJan 19
to Everything MUMPS
It's used, for example, to specify the `new` command. You can't use `new var(10)` or
`new ^var` for example, because the specification uses an __lname__ (local name) in
its specification. Does that help?

David Wicksell
Fourth Watch Software LC

David Wicksell

unread,
Jan 19, 2025, 8:35:34 PMJan 19
to Everything MUMPS
Gah! This is why I don't like lists where you can't edit your posts. LOL!
I obviously meant, "...because the standard uses an __lname__ (local name)
in its specification."

ed de moel

unread,
Jan 19, 2025, 8:43:42 PMJan 19
to Everything MUMPS
Indeed, they are all in the standard(s).
The definitions can be found in the Annotated Standards, starting from page:
(that page gives the ones with names starting with "A", use the pointing hands at the top of the pages to get to the other letters in the alphabet.


Kevin Toppenberg

unread,
Jan 21, 2025, 7:30:16 PMJan 21
to Everything MUMPS
Thank you David and Ed.  Very helpful!

:-)

Kevin
Reply all
Reply to author
Forward
0 new messages