[antlr-interest] Cobol number question
    Putrycz, Erik 
    Erik.Putrycz at nrc-cnrc.gc.ca
       
    Wed Apr  5 16:48:05 PDT 2006
    
    
  
I'm currently working on a COBOL grammar and I'm stuck with the
following case:
COMPUTE M-INTEREST = INTEREST / 12. 
The DOT at the end is the end of the instruction not a decimal dot.
I based my grammar on the python one (that has nice indentation
handling) and my numbers rule is the following:
NUMBER
            :           
            (           NonZeroDigit (Int)?
                        (           FloatTrailer {$setType(FLOAT);}
                                    |           {$setType(INT);}
                        )
            )                                   
    |   '.' {$setType(DOT);} // DOT (non number; e.g., field access)
            ;
 
protected
FloatTrailer
            :           '.' Int
            ;
 
The FloatTrailer fails with unexpected char: 0xA at the end of the
line... Obviously the second alternative of the NUMBER is not
considered... I'm not sure how to handle this properly. I would like to
keep in the parser that the instruction ends with a DOT.
 
Anyone would have an idea?
 
Thanks,
 
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/20060405/e8c29a75/attachment.html
    
    
More information about the antlr-interest
mailing list