Hi.
I am in the process of making a translator (HLSL->GLSL) using the
CSharp3 profile and have hit a few problems trying to get started
using a tree grammar to generate the template output. My first rule
for the compile unit tries to build a list of elements within the tree
but the code generation for the list rule seems to be incorrect.
public compileUnit
: (s+=globalDeclaration)* -> compileUnit(stats={$s})
;
Seems to create the list variable as a list of tree nodes but then
tries to create a list of string templates into it.
TemplateTreeRuleReturnScope<StringTemplate, HLSLTree> retval = new
TemplateTreeRuleReturnScope<StringTemplate, HLSLTree>();
retval.Start = (HLSLTree)input.LT(1);
List<HLSLTree> list_s = null;
TemplateTreeRuleReturnScope<StringTemplate, HLSLTree> s =
default(TemplateTreeRuleReturnScope<StringTemplate, HLSLTree>);
[...]
if (list_s==null) list_s=new List<StringTemplate>();
list_s.Add(s.Template);
I tried looking into the CSharp.stg file but this is a little over my
head since I am just starting to play with StringTemplates. Is there a
fix for this, or at least a workaround I could use to achieve the same
result?
Also, i've noticed some inconsistancies in regards to the $ use with
templates in my tests. For example:
typedefDefinition
: ^(OP_DECL_TYPEDEF a=ID b=varTypeSpecification) ->
typedef(x={$a.Text}, y={$b})
;
Will yield a code error for $b (the $ isn't stripped off). But
omitting $ sings overall seems to work. Am I doing something wrong?
Thanks,
Sebastien St-Laurent
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.