[antlr-interest] Retaining comments

Gavin Lambert antlr at mirality.co.nz
Thu Feb 28 02:32:55 PST 2008


At 10:27 28/02/2008, Darien Hager wrote:
>I originally had this same kind of assumption in my ongoing 
>experience as a newbie user. The combined grammar originally gave 
>me a sort of mental model that lexer rules were a special subset 
>of parser rules, special because they were the leafy tree 
>endpoints that were actually checked against the raw data as a 
>given rule was invoked.

Yes, it does seem to be a common misunderstanding.  And some other 
parser generators do indeed work like that.  But ANTLR does a 
complete lex first before the parse begins.  (In fact you can do 
the lexing step all by itself if you want to, or conversely do the 
lexing manually and only use ANTLR to parse.  It's up to you.)



More information about the antlr-interest mailing list