複数のソースファイルを解析して、分析とコード生成を実行するためのASTを1つだけにする方法を教えてください。通常、私はANTLRの使用例を次の形式で見つけます
public void process(String source)
{
ANTLRStringStream Input = new ANTLRStringStream(input);
TLexer lex = new TLexer(Input);
CommonTokenStream tokens = new CommonTokenStream(lex);
TParser parser = new TParser(tokens);
var tree = parser.parse().Tree;
}
しかし、レクサーもパーサーも追加のファイルを取得できないようです。レクサーとパーサーのprを作成することになっていますか?inputfileを使用し、tree.Add()を使用して、他のファイルのツリーを最初のファイルのツリーに追加しますか?