parser = classForName(parserName).asSubclass(Parser.class);
Constructor<? extends Parser> parConstructor = parser.getConstructor(TokenStream.class);
Parser parObj = parConstructor.newInstance(tokens); // makes new instance of parser
// set up customized tree adaptor if necessary
TreeAdaptor customTreeAdaptor = null;
if ( grammarInfo.getAdaptor()!=null ) {
Method _setTreeAdaptor = parser.getMethod("setTreeAdaptor", TreeAdaptor.class);
Class<? extends TreeAdaptor> _treeAdaptor = classForName(grammarInfo.getAdaptor()).asSubclass(TreeAdaptor.class);
customTreeAdaptor = _treeAdaptor.newInstance();
_setTreeAdaptor.invoke(parObj, customTreeAdaptor);