[antlr-interest] How to come up with catch-all rules?

Loring Craymer lgcraymer at yahoo.com
Fri Nov 17 17:08:09 PST 2006


I should point out that javaCC was inspired by PCCTS
(ANTLR 1) and that lexical modes were one of the very
cool features of dlg, the PCCTS lexer generator. 
Lexical state did not seem that important for ANTLR
2--the advance there was LL(k) lexing--but are slated
to return.

--Loring

--- Micheal J <open.zone at virgin.net> wrote:

> Hi,
> 
> > >  This is pretty good but still makes assumptions
> on the 
> > structure of 
> > > the hand-written code. For example, the number
> of { and } 
> > within the 
> > > outmost { and } need to match. It also makes
> assumptions on 
> > the syntax 
> > > of string, comments, and char literals. If I use
> perl style 
> > comments 
> > > in the hand-written code and write:
> > >
> > > # This will break ANTLR {{{
> > >
> > > It will cause syntax errors in ANTLR.
> > >
> > > Is there any even more general ways?
> > 
> > In JavaCC there's something called Lexical States,
> which essentially 
> > allow wholesale swapping of one lexer for another.
> The transitions 
> > between which lexer state is in effect are driven
> by the 
> > lexical rules 
> > themselves.
> [...]
> 
> > Is there any equivalent or counterpart to in
> ANTLR?
> 
> Island grammars in V3 and the TokenStreamSelector in
> V2.7.x are the closest
> features.
> 
> 
> Micheal
> 
> -----------------------
> The best way to contact me is via the list/forum. My
> time is very limited.
> 
> 



 
____________________________________________________________________________________
Sponsored Link

Don't quit your job - take classes online
www.Classesusa.com



More information about the antlr-interest mailing list