private IRGoal ASTGoalToIR(ASTGoal astGoal) { var goal = new IRGoal { InitSection = new List <IRFact>(astGoal.InitSection.Count), KBSection = new List <IRRule>(astGoal.KBSection.Count), ExitSection = new List <IRFact>(astGoal.ExitSection.Count), ParentTargetEdges = new List <IRTargetEdge>(astGoal.ParentTargetEdges.Count), Location = astGoal.Location }; foreach (var fact in astGoal.InitSection) { goal.InitSection.Add(ASTFactToIR(fact)); } foreach (var rule in astGoal.KBSection) { goal.KBSection.Add(ASTRuleToIR(goal, rule)); } foreach (var fact in astGoal.ExitSection) { goal.ExitSection.Add(ASTFactToIR(fact)); } foreach (var refGoal in astGoal.ParentTargetEdges) { var edge = new IRTargetEdge(); edge.Goal = new IRGoalRef(refGoal.Goal); edge.Location = refGoal.Location; goal.ParentTargetEdges.Add(edge); } return(goal); }
public IRGoal GenerateGoalIR(ASTGoal goal) { return(ASTGoalToIR(goal)); }