[antlr-interest] COBOL
Balvinder Singh
bals1978 at hotmail.com
Wed May 29 11:04:10 PDT 2002
Hi Sinan,
But If I will use your scheme, getting warning
warning:Syntactic predicate ignored for single alternative
what should I refactor?
balvinder
>From: Sinan <sinan.karasu at boeing.com>
>Reply-To: antlr-interest at yahoogroups.com
>To: antlr-interest at yahoogroups.com
>Subject: Re: [antlr-interest] COBOL
>Date: Wed, 29 May 2002 08:55:03 -0700
>
>Balvinder Singh wrote:
> >
> > Hi all,
> >
> > I'm writing cobol parser only for WORKING STORAGE AREA of data
>division.
> > I'm using grammar rule and lexical rule for WORKING STORAGE AREA from VS
> > COBOL II (http://adam.wins.uva.nl/~x/grammars/vs-cobol-ii/)
> >
> > I have converted lexical rule to ANTLR format, but I'm getting conflicts
>for
> > some of the rules, rules are as follows :
> >
> > Literal : NonNumeric | Numeric
> > ;
> >
> > protected
> > NonNumeric : '"' ( (~'"') | '"' '"' )* '"'
> > | '\'' ( (~'\'') | '\'' '\'')* '\''
> > | ('X' 'x') '"' HexDigits '"'
> > | ('X' 'x') '\'' HexDigits '\''
> > ;
>Factor this:
>
>NonNumeric : '"' ( (~'"') | '"' '"' )* '"'
> | '\'' ( (~'\'') | '\'' '\'')* '\''
> | ('X' 'x')( '"' HexDigits '"' | '\'' HexDigits '\'')
> ;
>
>
>
>
> > AphabeticUserDefinedWord : (('0'.. '9')+ ('-')*)* ('0' .. '9')* ('A'
>..
> > 'Z' 'a' .. 'z') ('A' .. 'Z' 'a' .. 'z' '0' .. '9')* (('-')+ ('A' .. 'Z'
>'a'
> > .. 'z' '0' .. '9')+)*
> > ;
>
>This is infinite lookahead. since you can have 9- , 99- etc...
>
>Fix it by saying
> AphabeticUserDefinedWord : ((('0'.. '9')+ ('-')*)=> ('0'.. '9')+
>('-')*)* ('0' .. '9')* ('A' ..
> 'Z' 'a' .. 'z') ('A' .. 'Z' 'a' .. 'z' '0' .. '9')* (('-')+ ('A' .. 'Z'
>'a'
> .. 'z' '0' .. '9')+)*
> ;
>
>
>
>
>Sinan
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list