[antlr-interest] Lists. Lexer or Parser?
Dave Pawson
dave.pawson at gmail.com
Fri Sep 12 06:58:32 PDT 2008
2008/9/12 Gavin Lambert <antlr at mirality.co.nz>:
>>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.)
Oh it is :-) I currently do the job with Python.
But I needed something real to learn on.
Obvious next question, how to do it in the Parser please?
I'm not that far in the Antlr book - seems like I do need a tree
with a non-existant node to hang the list item children from.
regards
--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk
More information about the antlr-interest
mailing list