[antlr-interest] Reuse tokens from multiple grammars in tree grammar

Robin diabeteman at gmail.com
Mon Nov 7 04:57:38 PST 2011


Hi all,

I'm curently working on a thesis project and I need to write tree grammars
that translate ASTs produced by several parsers (Java, C, etc) into
"generic" ASTs. These "generic" ASTs should only contain basic information
about the source code being parsed such as function signatures, class
names, etc.

I of course thought about ANTLR for this purpose but I'm facing some
problems:

* How can I define a set of imaginary tokens for this "generic" AST so that
they can be reused in tree grammars? (such as JavaToGeneric.g,
CToGeneric.g, etc)
* If I only want a portion of an AST to be translated, can I use option
"filter = true"?

I don't know if I've been clear, I could give examples of what I am trying
to accomplish if you need. If I'm going the wrong way, please tell me so.

Thanks in advance for your help :)

Robin


More information about the antlr-interest mailing list