[antlr-interest] ANTLR Questions

Bruno Marc-Aurele bruno.marc-aurele at polymtl.ca
Tue Jan 20 18:57:20 PST 2009


Hello everyone,

I am currently working on a project where I need to translate files (mainly
code) from one technology to another. I already have a LL(*) grammar for the
source language and I am considering rewriting this grammar using ANTLR to
benefit from C# generation target.

I have used JavaCC a lot in the past and I have some questions about ANTLR, a
tool that I find really promising for my project. I read the documentation, but
some things just still are unclear.

1) If I want to generate a parse tree, do I HAVE to use a tree grammar or will a
combined one work?

2) About the generated tree, what will be the types of the nodes? Will each rule
have its type (ex, rule test would have a Test() type node) or are all the nodes
the same type (NodeType, for example)?

2.1) I read the section about heterogenous nodes (using the <X> syntax), but all
the examples seem applied on token calls (ex: ID<V> and 'id'<V>). Does it work
on rule calls (ex: rule<V>)?

Your answers might spark new questions from me, but for now it's all I need to
know.

Thanks a lot for your support,
Bruno Marc-Aurèle.






More information about the antlr-interest mailing list