A hint: When you make a change, make sure the transition diagrams display. If you make a mistake, take care of it right away. Otherwise, it will not display the diagrams and it is really hard to find the error.
Another hint: Work from bottom up in the language. Having said that, you will discover that defining a highly recursive language like MUMPS is a whole lot of fun :-)
Please feel free to use this forum to communicate with me. I will need to know what is happening since I will have to take the working MUMPS 95 file and add EsiObjects to it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My first observation is that you ran afoul of the same thing I did when I was translating the MUMPS standard to YACC.
the standard says that the command seperator space is optional after argumentless commands.
But ONLY if the space is on the end of the line. It isn't optional if there are other commands on the line. This means your definition of some of the "argumentless" commands, including the BREAK, DO, ELSE, FOR, HALT, IF, commands will generate parse conflicts unnecessarily.
probably the simplest way to do this is to have a different version of command for last command on the line. I seem to recall that is what I did before. That way the "lastcommand" could have no command seperator space defined, but the regular "command" would require it. This would change your definition for "line" as I recall, so the all the commands are optional, except for the last command on the line, and then you have to have a special case for the line that has no linebody.
Incidentally, your DO definition doesn't allow for an argumentless DO
The patcode is actually problematic as I recall, as well, because you still have to check that CLEANUP are the only letters allowed, but the 1995 grammar says that in a table in the back which is tied to the characterset "M".
There is a minor typo in the definition of BREAK where you say ('A'|'k')
when you meant to say ('A'|'a')
A similar one is on the definition for JOB ('B'|'s') when you meant ('B'|'b')
Well, this should be enough to start.
Would you like me to try to make some of these changes? The alternative is to have you as the "gatekeeper of the SVN" so you understand all the changes made to the grammar.
Best Wishes,
Dave
713-870-3834
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This forum is dedicated to discussions surrounding the project to define the ANTLR EBNF for 1995 MUMPS and EsiObjects.
Because the EsiObjects language is an extension of the 1995 MUMPS standard, we are doing the 95 standard first. EsiObjects can then be added later.
You can pick up the file I started at the EsiObjects SVN at https://esiobjects.svn.sourceforge.net/svnroot/esiobjects/EsiObjects/Documentation/MetaLanguage
Please note that it is not perfect and there are mistakes. It's just a starting point.
You should download ANTLRWorks from http://www.antlr.org/works/index.html. It is the only sane way of working with this.
A hint: When you make a change, make sure the transition diagrams display. If you make a mistake, take care of it right away. Otherwise, it will not display the diagrams and it is really hard to find the error.
Another hint: Work from bottom up in the language. Having said that, you will discover that defining a highly recursive language like MUMPS is a whole lot of fun :-)
Please feel free to use this forum to communicate with me. I will need to know what is happening since I will have to take the working MUMPS 95 file and add EsiObjects to it.
My first observation is that you ran afoul of the same thing I did when I was translating the MUMPS standard to YACC.
the standard says that the command seperator space is optional after argumentless commands.
But ONLY if the space is on the end of the line. It isn't optional if there are other commands on the line. This means your definition of some of the "argumentless" commands, including the BREAK, DO, ELSE, FOR, HALT, IF, commands will generate parse conflicts unnecessarily.
probably the simplest way to do this is to have a different version of command for last command on the line. I seem to recall that is what I did before. That way the "lastcommand" could have no command seperator space defined, but the regular "command" would require it. This would change your definition for "line" as I recall, so the all the commands are optional, except for the last command on the line, and then you have to have a special case for the line that has no linebody.
Incidentally, your DO definition doesn't allow for an argumentless DO
The patcode is actually problematic as I recall, as well, because you still have to check that CLEANUP are the only letters allowed, but the 1995 grammar says that in a table in the back which is tied to the characterset "M".
There is a minor typo in the definition of BREAK where you say ('A'|'k')
when you meant to say ('A'|'a')
A similar one is on the definition for JOB ('B'|'s') when you meant ('B'|'b')
Well, this should be enough to start.
Would you like me to try to make some of these changes? The alternative is to have you as the "gatekeeper of the SVN" so you understand all the changes made to the grammar.
Best Wishes,
Dave
713-870-3834