[antlr-interest] Token as token and variable name

Putrycz, Erik Erik.Putrycz at nrc-cnrc.gc.ca
Wed Sep 27 15:20:57 PDT 2006


I'm having a problem writing a COBOL parser...

The record names can be anything, even reserved words (isn't that a
screwed up language?).

And I'm not sure how to solve this issue properly; my rule for records
fails when a reserved word is found...

 

This is a sample of the parser:

 

record

{           String rName = "FILLER";

            }

            : rec:INT^ {#rec.setType(RECORD);} 

            (nName:NAME { rName = #nName.getText();} |"FILLER")?

            (redefinesStatement)?

            ...

 

The record name (here NAME), can be any reserved token...

 

Erik Putrycz, Ph.D - Research Associate /
<mailto:erik.putrycz at nrc-cnrc.gc.ca> erik.putrycz at nrc-cnrc.gc.ca / (613)
990 0681

Institute for Information Technology - Software Engineering Group

National Research Council, Canada - Building M-50, 1200 Montreal Road

Ottawa, Ontario, CANADA K1A 0R6

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060927/30db372d/attachment.html 


More information about the antlr-interest mailing list