Midterm CSU 670 Fall 2006 Karl Lieberherr YOUR NAME Put your name on every answer sheet Question 1: ================================================== UNKNOWN1 = List(RuleState) UNKNOWN2 = UnaryS | BinaryS UNKNOWN3 = AExp UNKNOWN4 = "||" UNKNOWN5 = FExp UNKNOWN6 = ASimple | ACompound UNKNOWN7 = AssignmentName | OptDecisionLiteral | EmptyAssignment UNKNOWN8 = Concat UNKNOWN9 = List(AExp) UNKNOWN10 = FSimple | FCompound UNKNOWN11 = FormulaName | Constraint UNKNOWN12 = And UNKNOWN13 = List UNKNOWN14 = FExp UNKNOWN15 = "#L" Kind Variable UNKNOWN16 = "#F" UNKNOWN17 = "#A" Question 2: ================================================== UNKNOWN1 = Transitions = List(Transition) EOF. Transition = TransitionName BinaryS "=>" RuleState. RuleState : UnaryS | BinaryS. Question 3: ================================================== program.cd import edu.neu.ccs.demeter.dj.*; CSP = List(Constraint) EOF. Constraint = int "(" List(Variable) ")". Variable = int. List(S) ~ {S}. ForcedVisitor = extends Visitor. program.input 22( 1 2 3) 102(2 3) 85(1) program.beh Main { {{ Main { {{ static ClassGraph cg; static public void main(String args[]) throws Exception { CSP cs = CSP.parse(System.in); ClassGraph cgc = new ClassGraph(true, false); cg = new ClassGraph(cgc, "from CSP bypassing -> *,tail,* to *"); cs.process(); } }} } CSP { {{ void process(){ ForcedVisitor fV = new ForcedVisitor(); Main.cg.traverse(this,"from CSP to Variable", fV); }} } ForcedVisitor { {{ private int relationNumber; private int varaiblePosition; private boolean forced; public void before(Constraint c){ variablePosition=1; forced=false; relationNumber=c.get_relationNumber(); } public void before(Variable v){ if (!forced) { if (forced(relationNumber,variablePosition)!=-1){ System.out.println(relationNumber); } else variablePosition++; } } }} } Question 4 =========================================================== UNKNOWN1 {}||1+2+3, 1+2+!3, !1+4, 1+!2+3, !1+!4, 1+!2+!3 by Decide 1*|| "" by Semi-Superresolution 1*|| "" ,!1 by Restart {}||1+2+3, 1+2+!3, !1+4, 1+!2+3, !1+!4, 1+!2+!3, !1 by UnitPropagate !1||"" by Decide !1 2*||"" by Semi-Superresolution !1 2*||"",!2 by Restart {}||1+2+3, 1+2+!3, !1+4, 1+!2+3, !1+!4, 1+!2+!3, !1, !2 by UnitPropagate !1||"" by UnitPropagate !1 !2||"" by UnitPropagate !1 !2 3||"" by Fail FailState Question 5: ================================================== UNKNOWN1 = UNKNOWN2 = UNKNOWN3 = UNKNOWN4 = UNKNOWN5 = UNKNOWN6 = UNKNOWN7 = UNKNOWN8 = UNKNOWN9 = UNKNOWN10 = UNKNOWN11 = UNKNOWN12 = UNKNOWN13 = UNKNOWN14 = UNKNOWN15 = UNKNOWN16 = UNKNOWN17 = UNKNOWN18 = UNKNOWN19 = UNKNOWN20 = UNKNOWN21 = UNKNOWN22 = UNKNOWN23 = UNKNOWN24 = UNKNOWN25 =