I’am new to Antlr and exploring and in recent few weeks got a good understanding on how to use it.
I’m trying to build grammar for COBOL programs, does anyone have ready to use COBOL grammar apart from what is available on GITHUB. On GITHUB COBOL 85 is available.
The free / open source grammars you find will probably be a good place to start – it may work fine for you. If those turn out to be insufficient and you don’t want to invest the time in making them complete enough for your project, sounds like you have a commercial option.
This is an LR type of grammar as opposed to an LL type grammar and should work
find with the LRSTAR parser generator
The COBOL 85 language is LR(2) if you ignore the tokens: IS and ARE. Otherwise
the language is LR(3). LRSTAR should be able to handle LR(3) but I have not tested
this grammar, yet, to see if it successfully reads using the LR(3) option.
I did test it in 1995 with an LALR(1) parser generator and it was working fine, except
for the READ statement which is LALR(2).
ANTLR may have trouble with this grammar because it is an LR style grammar (with
left recursion).