for (AGEval.Class c : aleg.classes) {
//simple assignments
if (chainLoopsChilds) {
for (Assignment a : ast.assignments) {
if (a._class == c && a.loopVar.equals("")) {
if (a.isReduction) throw new InvalidGrammarException("Reduction in non-loop!");
if (a._variables.size() == 0) {
String asgn = "assignment(" + c.getName().toLowerCase() + ", "
+ attribBase(a._sink).toLowerCase() + ", " + attribName(a._sink).toLowerCase() + ", "
+ "self, " + fakeAttribute + "). %a40\n"; //force scheduling of nullary
res += asgn;
} else {
for (String src : a._variables.keySet()) {
if (src.contains("$$")) {
boolean isChild = !attribBase(src).toLowerCase().equals("self");
res += "assignment(" + c.getName().toLowerCase() + ", "
+ attribBase(a._sink).toLowerCase() + ", " + attribName(a._sink).toLowerCase() + ", "
+ "self, " + (isChild ? attribBase(src).toLowerCase() + "_" : "") + attribName(src.replace("$$", "_stepn")).toLowerCase() + "). %a41\n"; //change to _last?
} else {
res += "assignment(" + c.getName().toLowerCase() + ", "
+ attribBase(a._sink).toLowerCase() + ", " + attribName(a._sink).toLowerCase() + ", "
+ attribBase(src).toLowerCase() + ", " + attribName(src).toLowerCase() + "). %a42\n";
}
}
}
}
}
} else {
for (AGEval.Function func : c.getFunctions()) {
for (String src : func.getStringSrcs()) {
String asgn = "assignment(" + c.getName().toLowerCase() + ", "
+ attribBase(func.myDest).toLowerCase() + ", " + func.getDestination().getExtVar().toLowerCase() + ", "
+ attribBase(src).toLowerCase() + ", " + attribName(src).toLowerCase() + "). %a43\n";
res += asgn;
}
if (func.getStringSrcs().length == 0) {
String asgn = "assignment(" + c.getName().toLowerCase() + ", "
+ attribBase(func.myDest).toLowerCase() + ", " + func.getDestination().getExtVar().toLowerCase() + ", "
+ "self, " + fakeAttribute + "). %a44\n"; //force scheduling of nullary
res += asgn;
}
hasAs = true;
}
}
//conds
if (ast.condsTop.containsKey(c)) {
for (Cond cond : ast.condsTop.get(c)) {
res += condAssignments(genSym.fake(), c, cond, genSym, reducts);
throw new InvalidGrammarException("Deprecated: conditionals");
}
}
//loop assignments
for (ALEParser.Assignment asgn : ast.assignments)
if (asgn._class == c && !"".equals(asgn.loopVar))