[antlr-interest] how to let parser control lexer state.

Loring Craymer lgcraymer at yahoo.com
Fri Apr 27 10:42:24 PDT 2007


That's what semantic predicates (in the parser) are
for--there are no lexical issues involved in this
case.  You want to do the symbol table lookup and test
in a predicate.

--Loring

--- femtowin1 <femtowin1 at gmail.com> wrote:

> Hi all, in antlr3, can parser control lexer state
> and decide how lexer lexing? some grammar has
> ambiguity
> decided upon by parser knowledge.
>   for ruby grammar <<
> x << 1
> test
> 1
> if x is a variable, then << is shift operator,
> otherwise it is a heredoc. so lexing must know
> from the symbol table whether x has been defined
> beforehand. But current antlrv3 implementation,
> lexer lexing to a constant token stream, and feed
> it into parser, so can't achieve this effect.
> ______________________________________
> Sent from my www.pageflakes.com startpage
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the antlr-interest mailing list