use of com.rockwellcollins.atc.agree.analysis.TypeTable in project AGREE by loonwerks.
the class AgreeASTBuilder method getAgreeProgram.
public AgreeProgram getAgreeProgram(ComponentInstance compInst, boolean isMonolithic) {
boolean containsRTPatterns = false;
this.isMonolithic = isMonolithic;
globalNodes = new ArrayList<>();
uninterpretedFunc = new ArrayList<>();
renamings = new HashMap<>();
refMap = new HashMap<>();
// EGM: array-backend
symbolTable = new TypeTable();
AgreeNode topNode = getAgreeNode(compInst, true);
List<AgreeNode> agreeNodes = gatherNodes(topNode);
// EGM: array-backend
List<Type> lustreTypes = symbolTable.getLustreTypes();
// have to convert the types. The reason we use Record types in the
// first place rather than the more general types is so we can check set
// containment easily
AgreeProgram program = new AgreeProgram(agreeNodes, new ArrayList<>(globalNodes), new ArrayList<>(uninterpretedFunc), lustreTypes, topNode);
// if there are any patterns in the AgreeProgram we need to inline them
program = AgreePatternTranslator.translate(program);
containsRTPatterns = program.containsRealTimePatterns;
program = AgreeInlineLatchedConnections.translate(program);
program = AgreeMakeClockedLustreNodes.translate(program);
// go through the extension registries and transform the program
AgreeAutomaterRegistry aAReg = (AgreeAutomaterRegistry) ExtensionRegistry.getRegistry(ExtensionRegistry.AGREE_AUTOMATER_EXT_ID);
List<AgreeAutomater> automaters = aAReg.getAgreeAutomaters();
for (AgreeAutomater aa : automaters) {
program = aa.transform(program);
}
program.containsRealTimePatterns(containsRTPatterns);
// EGM: DEBUG
System.out.println("getAgreeProgram");
com.rockwellcollins.atc.agree.analysis.ast.visitors.AgreeASTPrettyprinter pp = new com.rockwellcollins.atc.agree.analysis.ast.visitors.AgreeASTPrettyprinter();
program.accept(pp);
System.out.println(pp.toString());
System.out.println(AgreeLogger.getLog());
return program;
}
Aggregations