[antlr-interest] source-to-source transformation question

young898 feng898 at juno.com
Fri Nov 8 09:22:53 PST 2002


I am learning ANTLR. I'd like to transform the following inputfile to 
the outputfile using ANTLR.

input: Foo.java
public class Foo {
	/** constants are in uppercase */
	public String CONST="aa";
	//public variable will be changed to private
	public int age;
}
output: 
public class Foo {
	/** constants are in uppercase */
	public final static String CONST="aa";
	//public variable will be changed to private
	private int i;
	public int getAge(){
		return age;
	}
	public void setAge(int a){
		age=a;
	}
}
Would anybody show me how to do it using ANTLR?
I know how to do it in Perl or java regular expression package.
I have read java.g and java.tree.g in the ANTLR examples section.  It 
might be possible to modify these files and achieve the result. Would 
anybody show me how to do it? 
Thank you!	

Jay	



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list