[antlr-interest] Antlr first time user, help requested

Andrew Robinson andrewrwr at gmail.com
Tue Jul 6 12:13:56 PDT 2010


Thank you for all the help, I got it parsing the way I want (I
attached the grammar file for anyone interested). Now I am wondering
what the best method is to walk the AST tree. In a groovy script, I
used their visitor pattern (SourceCodeTraversal in combination with
their VisitorAdapter class) to extract the information I wanted.

Basically for this, I want the values of the tags:

PageMetaData:
name: This is a test name
categories: category1, category2,
 category3
notes: These are notes
 that the newlines are important, but not the leading whitespace

So I would like the name,"This is a test name", categories in a way I
can parse them into java enum constants added to a java-collection,
etc.

Is building a visitor a good way to go for this, or perhaps using code
blocks in the parser to capture the text I want, or what other
suggestions might you have on a recommended approach to interact with
the parsed code or AST?

Thanks again.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PageMetaData.g
Type: application/octet-stream
Size: 2271 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20100706/6ee66d6f/attachment.obj 


More information about the antlr-interest mailing list