[antlr-interest] Fixed field

Jim Idle jimi at temporal-wave.com
Sat Jul 31 11:28:37 PDT 2010


I did not say that it was analytically ambiguous. My point was that there is
little value, if any in a grammar which basically boils down to

(LTR* NL)* ;

Jim

> -----Original Message-----
> From: William Clodius [mailto:wclodius at los-alamos.net]
> Sent: Friday, July 30, 2010 7:40 PM
> To: Jim Idle
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Fixed field
> 
> 
> On Jul 30, 2010, at 11:26 AM, Jim Idle wrote:
> 
> > I think that you are barking up the wrong tree here. All your rules
> > are completely ambiguous and if any of the fields do not exactly
> > correspond to the number of letters, this will all fall over. ANTLR is
> > not really meant for parsing fixed width fields where each field is just
some
> arbitrary text.
> > You should just use something like awk to do this, or even a very
> > simple java class that just reads a buffered input stream line by line
> > and picks out the fields.
> >
> > Jim
> <snip>
> 
> Ambiguity is not a problem here, per se. If the grammar were completely
> ambiguous I would expect ANTLR to report problems before he has a chance
> to parse a file. I suspect his specific problem can be fixed by requiring
that
> agenda end with an end of file token. However you are correct that
> automated lexing tools such as ANTLR are not designed for fixed width
fields
> and the convolutions required to handle such fields are as easily handed
by
> handwritten lexers, which in turn are more amenable to error reporting.



More information about the antlr-interest mailing list