At 01:58 13/09/2008, Dave Pawson wrote:
>Obvious next question, how to do it in the Parser please?
Just output whatever you want. Like so:
list : { Console.writeLine("<list>"); } item* {
Console.writeLine("</list>"); } ;
item : TEXT { Console.writeLine("<item>", $TEXT.text, "</item>");
} ;
>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.
Maybe you should read more of the book :)
And you can do it like that if you want to (eg. if you want to
generate an AST you can manipulate or generate multiple kinds of
output from), but if your needs are simple then you might as well
just do the output directly in the parser.
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---