Importing An External AST Into ANTLR
I want to build a Javascript source processing tool with ANTLR.  Since Mozilla's Javascript engine Spidermonkey already able to parse Javascript and output an AST (which by itself is a Javascript object tree), all I need is just to utilize ANTLR's tree grammar features to parse that AST.  I don't have to create my own Javascript source parser grammar.

But, the problem is, how do we import an external AST into a form that ANTLR's tree grammar can recognize?  According to *The Definitive ANTLR Reference* most likely I'd need to create my own *TreeAdaptor*.  But what methods should be I override?  The Spidermonkey's AST is a heterogenous tree where different node types are used for different statements.  I'd need to manually map this heterogenous tree into a tree form that ANTLR is capable of processing where a single *CommonTree* type is used for all nodes.

My ANTLR target language can be Javascript or anything (since the AST generated by Spidermonkey is a Javascript object tree).
Importing An External AST Into ANTLR
===

I want to build a Javascript source processing tool with ANTLR.  Since Mozilla's Javascript engine Spidermonkey already able to parse Javascript and output an AST (which by itself is a Javascript object tree), all I need is just to utilize ANTLR's tree grammar features to parse that AST.  I don't have to create my own Javascript source parser grammar.

But, the problem is, how do we import an external AST into a form that ANTLR's tree grammar can recognize?  According to *The Definitive ANTLR Reference* most likely I'd need to create my own *TreeAdaptor*.  But what methods should be I override?  The Spidermonkey's AST is a heterogenous tree where different node types are used for different statements.  I'd need to manually map this heterogenous tree into a tree form that ANTLR is capable of processing where a single *CommonTree* type is used for all nodes.

My ANTLR target language can be Javascript or anything (since the AST generated by Spidermonkey is a Javascript object tree).