It probably is a bug I am afraid. 3.2.1 will be a 'catch up' release to ensure 
that everything works in C. You can make calls to LT() directly and so on 
though.

 

For index and related properties you should use the method calls rather than 
the fields directly, but if you know you will never override the structure 
types then you only have to worry if I change the names of the fields. This is 
not likely, but I don't guarantee not to do it. 

 

Nodes are valid between tree walks and rewrites so long as you do not free the 
node streams until you are completely done. You can dup a node outside the 
factory and then it will persist, but you need to free the memory.

 

Jim

 

From: [email protected] 
[mailto:[email protected]] On Behalf Of Mohamed Yousef
Sent: Monday, October 26, 2009 10:42 PM
To: [email protected]
Subject: [antlr-interest] [C Target] Bug in AST walking , implementing control 
flow

 

Hi,
on trying to implement control flow , in an AST walker grammar 
following this example : 
http://www.antlr.org/wiki/display/CS652/Tree-based+interpreters

ifstat


    :   ^('if' c=expr s=. e=.?) // ^('if' expr stat stat?)


in the C target the problem is that in the generated code , variables e,s are 
not defined! (yet they are assigned values )
and the compiler complains about that , when i do define them by hand (under 
the definition of variable c  )
the code compiles fine
so is this really a bug or i'm misusing ? any applicable workarounds ?
----
i have another question regarding control flow in c target
to get the index of say c in above example i write
c.tree->getToken(c)->index ,, right ? i can then SEEK to thins index , and i 
can save 
it in a symbol table , and it will be valid across different tree walks (walk 
filling symbol table and
the walk that really interprets code )  ,, right ?

Thanks,
Mohamed Yousef




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to