[antlr-interest] New user

Matt Benson gudnabrsam at yahoo.com
Tue Sep 10 14:34:33 PDT 2002


I believe I begin to understand.  Accounting for
comments in the Java grammar, for example, would
necessitate liberally sprinkling the tokens throughout
the parser rules, to represent the fact that they can
occur anywhere.  The end of having the tokens in the
tree might not be worth the effort and resulting
unreadable parser rules, correct?  The other option
you mentioned, adding comments as attributes of nodes,
I do not understand.  Would this approach be
applicable to my situation and if so how is it most
easily accomplished?

TIA,
Matt

--- mzukowski at yci.com wrote:
> I'm not sure what the transmorgify framework does,
> but if it isn't handling
> the COMMENTs  then you have to.  Typically COMMENTs
> are put along side of
> nodes (as an attribute or instance variable of a
> node) instead of inserted
> into the actual tree, because if they are in the
> tree itself then they have
> to be accounted for in the grammar, which is messy
> for comments because
> those can be anywhere.
> 
> Monty
> 
> > -----Original Message-----
> > From: Matt Benson [mailto:gudnabrsam at yahoo.com]
> > Sent: Thursday, August 29, 2002 2:59 PM
> > To: antlr-interest at yahoogroups.com
> > Subject: Re: [antlr-interest] New user
> > 
> > 
> > As promised, I have come up with a question!  :)
> > 
> > Now, so we know, my interest in Antlr is, thus
> far,
> > restricted to java.g.  Right now I am interested
> in
> > comments.  I am parsing a Java file with both
> single
> > and multiline comments, and running it through a
> > TokenStreamHiddenTokenFilter using my own modified
> > version of the Transmogrify framework.  I have
> > disabled the code that sets SL_COMMENT and
> ML_COMMENT
> > to be hidden in the TokenStreamHiddenTokenFilter;
> > however I still cannot see them when I display my
> > syntax tree using an ASTFrame.  Does anyone have
> any
> > clue why?
> > 
> > Sorry for the too-specific problem... :)
> > 
> > -Matt
> > 
> > 
> > --- Matt Benson <gudnabrsam at yahoo.com> wrote:
> > > I had pretty much determined the meanings of ()*
> and
> > > ()+  but what, then, is the origin of the terms
> > > "closure subrule" and "positive closure subrule"
> ? 
> > > Have I just not read enough yet?  :)
> > > 
> > > Anyway, I just upgraded to the newer version and
> it
> > > seems to have solved my compilation problem. 
> > > Tomorrow
> > > I'll probably come up with more!
> > > 
> > > Thanks a lot,
> > > Matt
> > > 
> > > --- Terence Parr <parrt at jguru.com> wrote:
> > > > 
> > > > On Wednesday, August 28, 2002, at 02:13  PM,
> Matt
> > > > Benson wrote:
> > > > 
> > > > > I had looked in the FAQ and seen the
> relevant
> > > > article.
> > > > >  I had not seen the Getting started with
> Antlr
> > > > > article.  I guess my biggest problem is
> unifying
> > > > the
> > > > > table in the manual that shows the
> punctuation
> > > and
> > > > > keywords with English descriptions. 
> > > Understanding
> > > > the
> > > > > difference between a subrule, a closure
> subrule,
> > > > and a
> > > > > positive subrule seems like something that's
> > > only
> > > > > going to come with much perusal of the
> > > > documentation,
> > > > > or more education in the field of parsing in
> > > > general.
> > > > 
> > > > Ah.  well a subrule just lets you put
> alternatives
> > > > in-line instead of 
> > > > making another rule like this:
> > > > 
> > > > a : A (B|C) ;
> > > > 
> > > > The "(...)*" closure means zero more times
> around
> > > > the loop and (...)+ 
> > > > means at least once :)
> > > > 
> > > > >
> > > > > The biggest problem I am facing at the
> moment is
> > > > this:
> > > > >  if I run Antlr on the latest java.g from
> John
> > > > Pybus
> > > > > via the ant-interest list, its declared
> > > > charVocabulary
> > > > > fills JavaLexer.java with various
> unicode/octal
> > > > escape
> > > > > sequences that will not compile with Sun's
> javac
> > > > for
> > > > > either 1.3 or 1.4.  I get various "empty
> > > character
> > > > > literal", "unclosed character literal", and
> > > > "illegal
> > > > > unicode escape" errors.  I am using Antlr
> 2.7.1.
> > > 
> > > > Do I
> > > > > need to upgrade to the new alpha?
> > > > 
> > > > Yup...the 2.7.2a2 release (nearly the final
> thing)
> > > > will fix lots of 
> > > > that.
> > > > 
> > > > Ter
> > > > 
> > > > 
> > > >  
> > > > 
> > > > Your use of Yahoo! Groups is subject to
> > > > http://docs.yahoo.com/info/terms/ 
> > > > 
> > > > 
> > > 
> > > 
> > >
> __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Finance - Get real-time stock quotes
> > > http://finance.yahoo.com
> > > 
> > >  
> > > 
> > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/ 
> > > 
> > > 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Finance - Get real-time stock quotes
> > http://finance.yahoo.com
> > 
> >  
> > 
> > Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ 
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/ 
> 
> 


__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute

 

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



More information about the antlr-interest mailing list