Hi there, I am not sure what 'DS' means in your post.
I am still using Antlr3, and I wanted to serialize the Trees produced by Antlr when the grammar is of the output=AST variety. I noted that CommonTree was not java.io.Serializable, so I added add this to my .g file:
/*
CommonTree not serializable, so we subclass
and supply the Serializable interface. Our
SerializableTree object then created by way
of our CommonTreeAdaptor instance set in the parser
*/
static class SerializableTree extends CommonTree
implements Serializable {
SerializableTree( Token t ) {
super( t );
}
}
wincParser parser = new wincParser( tokens,
new BlankDebugEventListener() );
parser.setTreeAdaptor( new CommonTreeAdaptor() {
@Override
public Object create( Token t ) {
return new SerializableTree( t );
}
} );
In my case, my source was not changing, so I had no need to parse over and over.
I know this isn't quite what you were after, but I thought it related enough to share.
Stuart