[antlr-interest] Lists. Lexer or Parser?

Gavin Lambert antlr at mirality.co.nz
Fri Sep 12 05:08:04 PDT 2008


At 21:46 12/09/2008, Dave Pawson wrote:
 >* kdkdkdkdk
 >* ldldldldld
 >
 >Using the Lexer is easy enough to get into a list element 
markup,
 >is it possible to use the lexer to wrap all the list elements
 >in a list tag?
 >
 >I.e. how to create
 >
 ><list>
 ><item>kdkdkdk</item>
 ><item>ldldldl</item>
 ></list>
 >
 >
 >or is that a job for the Parser or AST?

Generating output is usually the responsibility of the parser or 
tree parser, yes.  But if your input language is simple enough 
then there's no particular reason why you *couldn't* do all the 
work in the lexer, if you wanted to.

(Of course, if your input language is simple enough for that to be 
a viable option, there's a good chance that it's simple enough 
that using ANTLR or any other parser generator is just overkill.)



More information about the antlr-interest mailing list