Hi,

I'm trying to implement compile time reflections, so inside the language 
(imagine java) there is a preprocessor like language which can access 
static properties of elements defined in the language:

Example:

class Test
{
     int i,j;

     Test()
     {
         //iterates over all members of Test
         #for_all($m,t...@members)
         {
             $m=0;
         }
         //will be evaluated to:
         i=0;
         j=0;
     }
}

It doesn't make sense to implement this in a preprocessor since the full 
AST is needed to process the #for_all directive.
Therefore, I'd like to implement it in the grammar of the language. Now, 
the problem is that the #for_all (and other related directives) can be 
placed anywhere (outside of classes, etc). So I would need to put the 
rule for #for_all into all the rules inside my grammar which seems ugly 
and cumbersome.

Any ideas how to solve this?

Thx,
Alex



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

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

Reply via email to