[antlr-interest] how to print tokens?

Michael West quagly at mitzit.net
Thu May 12 16:13:28 PDT 2005


I have a thousand sql select statements and need to report on the tables
and
views they refer to.  Can antlr help me with this?  Should antlr help me
with this?

Almost all of the sql is sqlserver2000.  The grammer at:
http://www.antlr.org/grammar/1062280680642/MS_SQL_SELECT.html

seems to parse fine, and I can have it print out matches to simple leaf
rules using element labels.  Can I do it with rule references?  I don't
see how.

I think I would be happy if I could just print out all of the leaves
attached to
the tokens which match a rule.  It seems that AST is more suited to
this, but this is not an AST grammer.

This is my first look at antlr so I am probably looking at my problem in
the wrong way.  I have been through the tutorials and read much of the
antlr spec.

~Michael West



More information about the antlr-interest mailing list