[stringtemplate-interest] 2. Attempt: ANTLR code generation target/Stringtemplate: modifying the C-Runtime I

Terence Parr parrt at cs.usfca.edu
Sun Dec 4 15:44:29 PST 2011


Hi Udo, IJust spent a few minutes trying to figure out exactly what's going on with your issue: missing <token> value, but without digging through all of the ANTLR templates and the code that injects attributes, I'm afraid I won't be able to track down why attribute token has no value. Sorry.
Ter
On Nov 25, 2011, at 5:40 PM, Udo Weik wrote:

> Hello Terence,
> 
> thanks for your answer!
> I know, I know your students and the end of the year....
> 
>>> I startet to modify the C-Runtime and have a first bunch of
>>> questions. Be sure, more will follow - "Eeek, what a pain!"...
>>> 
>>> 1.<token>  in<action>
>>>     I need the token of an rule in the<action>-section
>>>     /** How to execute an action (when not backtracking) */
>>>     execAction(action) ::=<<
>>>     <if(backtracking)>
>>>     <if(actions.(actionScope).synpredgate)>
>>>     if (<actions.(actionScope).synpredgate>  )
>>>     ...
>>>     <ruleDescriptor.name>  and<ruleName>  are replaced (what is the
>>>     difference?) but<token>  not. Why?
>> 
>> So in the execAction template you want to reference<token>? What do you mean by token in a rule? you can get a tree for the rule in the Rule object:
>> 
>> 	/** The AST representing the whole rule */
>> 	public GrammarAST tree;
> 
> Attached you will find a pdf-file which explains my problem -
> state-of-the-art highlighted in colour!
> And then there is still the question:
>  <ruleDescriptor.name> and <ruleName> what is the difference?
> 
> I asked Jim already - I just copied his template-dir, renamed the
> file C.stg to CRtMod1a.stg and added my "pathfinder"-comments
> beginning with //! , followed by tg__ (test grammar) or tt__
> (test template). Only the *.c-file is generated, the *.h-file
> is missing. Why?
> 
> 
> Again many thanks and greetings
> Udo
> 
> 
> 
> 
> 
> <CRtMod1a__Test1aParser.pdf>



More information about the stringtemplate-interest mailing list