[antlr-interest] where is cminus.tar.gz?

Michael West quagly at me.com
Tue Jan 18 15:27:27 PST 2011


Thanks, I found them there.  However the grammar in examples-v3 seems to be
different though functionally equivalent to the one in the Language
Translation Using ANTLR and StringTemplate article.  For example, I don't
see the "helper function" 

StringTemplate template(String name) {
    return Main.templates.getInstanceOf(name);
}

Nor do I see any "returns" in the grammar which are used in many places in
the article.  An example from the article is:

assignStat returns [StringTemplate code=null]
{StringTemplate a=null;}
    :   id:ID ASSIGN a=expr
        {
            code=template("assign");
            code.setAttribute("lhs", id.getText());
            code.setAttribute("rhs", a);
        }
    ;

I took another look through the Definitive ANTLR Reference but did not find
this example discussed.

So the text of the great explanatory article does not correspond to the
grammar I have.  Well, I would rather have working code then text so I will
try to understand what is happening in the grammar.  

What I struggling with is how all those templates become a final template
that you can call toString() on.  From the article I understood that
returning StringTemplates was a key to this.  With no returns how does it
work?  It seems like an ordered list of templates may be getting created and
then toString() called on each one in order.

-- 
View this message in context: http://antlr.1301665.n2.nabble.com/where-is-cminus-tar-gz-tp5935862p5937675.html
Sent from the ANTLR mailing list archive at Nabble.com.


More information about the antlr-interest mailing list