[antlr-interest] help with instrumentor

Terence Parr parrt at cs.usfca.edu
Tue Nov 28 18:01:48 PST 2006


On Nov 28, 2006, at 4:36 AM, Naimal Khan wrote:

> Hi every one,
> I want to develop a java Source code instrumentor for analysing the  
> source code. For example i want to analyse a conditional statement  
> such as x1=10; x2=12; . . . xn=6 and i've condition such as if  
> ((x1<x2)&& (x3>x5)) {do this thing;} else {do that thing;} at this  
> point i want the instrumentor to insert code. e.g, declare temp1,  
> temp2,...tempn variables (egual to the number of variable used in  
> the condition) and then return the values such as (x2-x1)+(x3-x5).  
> Can i do such kind of intrumentation with ANTLR? how?

You want to think about TokenRewriteStream in v3 or  
TokenStreamRewriteEngine in v2.

Ter



More information about the antlr-interest mailing list