[antlr-interest] COBOL

Silvain Piree s.piree at enneya.com
Wed May 29 00:51:59 PDT 2002


>  I'm writing cobol parser only for WORKING STORAGE AREA
> of data division. I'm using grammar rule and lexical rule for 
> (http://adam.wins.uva.nl/~x/grammars/vs-cobol-ii/)

The Cobol grammar you are refering to was implemented using
the parser-generator from the University of Amsterdam which
is a "generalized LR" parser generator.

This GLR parser doesn't use a separate lexer for tokenizing the
way ANTLR does. If you want to use ANTLR then you need
a different solution, i.e. define tokens like identifier, integer, float, 
etc. and grammar rules like: 

    working_storage: "working" "storage" (data_definition)* ;
    data_definition: level_number data_name;
    level_numer: TOKEN_INTEGER ;
    data_name: TOKEN_IDENTIFIER ;

Hope this helps a bit, good luck, Silvain

p.s. you will probably need a separate lexer to tokenize the picture
      clause, which has different syntactic rules.
p.s. also, you'll need to find a solution for the missing period after a
      data definition, which is allowed by the ibm cobol compiler, but
      is not part of the official language specification.
p.s. and how do you intend to support the COPY statements in the
      working storage section?


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list