[antlr-interest] A newbie question and is this mailing listablack hole for

Loring Craymer lgcraymer at yahoo.com
Tue Oct 24 10:27:30 PDT 2006



--- Foolish Ewe <foolishewe at hotmail.com> wrote:
> 1) Are my assumptions wrong? Is using the parser to
> control lexer a bad 
> idea?

Yes.  The problem is lookahead--decisions are made
based on not only the next token but sometimes several
more after that.  "Now" for the parser could be 5
tokens in the "past" for the lexer.  That is probably
why you encountered unexpected results when you tried
to add feedback.

>     Is it really the right thing to push the
> scanner's work back on the 
> parser?

Separating functionality between parser and lexer is
sometimes a challenge.  Sometimes it is a case of
"whatever works"; other times, there is a clear
boundary.  Judgement improves with experience; I
cannot think of a set of hard and fast rules.  Messy
problems sometimes have messy solutions!

--Loring

> 2) If I'm right, what is the name of the handle to
> lexer of type L in P of 
> type parser?
> 3) If I'm right, what is the syntax for referencing
> lexer.recognizeKeyWords 
> in parser?
> 
> Regards:
> 
> Bill M.


__________________________________________________
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