[antlr-interest] C# antlr-dotnet-tool-3.3.1.7705 issue with collected template list

David Daeschler david.daeschler at gmail.com
Fri Feb 25 11:24:44 PST 2011


Hello,

I am using antlr-dotnet-tool-3.3.1.7705 and beginning work on a template to
translate from a high level language to bytecode.

One of my rules looks something like this:

script : (g+=globalVar)+
-> file(globalVars={$g})

globalVar
: ^(VAR_DECL TYPE ID .?)
-> vardec(type={$TYPE.text}, id={$ID.text})
;

It appears that the code being generated in this case to collect the
templates is slightly off. The type of list to hold the returned result is:

List<MyAST> list_g = null;

But when the collection is done, it is expecting the list to hold a
stringtemplate:

if (list_g==null) list_g=new List<StringTemplate>();
list_g.Add(g.Template);

I have confirmed my output is set correctly:

options {
language = 'CSharp3';
tokenVocab = MyVocab;
ASTLabelType = MyAST;
output = template;
}


Is there anything else I need to do?

Thank you very much for any help.
-- 
David Daeschler


More information about the antlr-interest mailing list