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
(some of the alternatives may be in 6)

UNKNOWN8 = Concat

UNKNOWN9 = List(AExp) (or List(ASimple))

UNKNOWN10 = FSimple | FCompound

UNKNOWN11 = FormulaName | Constraint

UNKNOWN12 = And

UNKNOWN13 = List

UNKNOWN14 = FExp (or FSimple)

UNKNOWN15 = "#L" Kind Variable

UNKNOWN16 = "#F"

UNKNOWN17 = "#A"




Question 2: 
==================================================

UNKNOWN1 = 

Transitions = List(Transition) EOF.
Transition = TransitionName <source> BinaryS "=>" <target> RuleState.
RuleState : UnaryS | BinaryS.






























Question 3: 
==================================================
import edu.neu.ccs.demeter.dj.*;

CSP = List(Constraint) EOF.
Constraint = <relationNumber> int "(" <vars> List(Variable) ")".
Variable = <v> int.
List(S) ~ {S}.

ForcedVisitor = extends Visitor.
Relation = .
Main = .

// as part of the Demeter Interface we assume that 
// relation numbers and variable numbers alternate
// as shown in the above class graph.
// violation of Terminal Buffer Rule:

// RelationNumber = <v> int.
// would be better.
// better to use fetch to access relation number.

program.input
=========================================

22( 1 2 3)
102(2 3)
85(1)

program.beh
=========================================

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 variablePosition;
  private boolean forced;
  public void before(Constraint c){
    variablePosition=1;
    forced=false;
    relationNumber=c.get_relationNumber();
  }
  public void before(Variable v){
    if (!forced) {
      if (Relation.forced(relationNumber,variablePosition)!=-1){
        System.out.println(relationNumber);
	forced = true;
      } else variablePosition++;
    }
  }
}}
}
Relation {
{{
  static int forced( int r , int v ){return 1;}
}}
}

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 = 30 

UNKNOWN2 = 28

UNKNOWN3 = * *

UNKNOWN4 = 2

UNKNOWN5 = * *

UNKNOWN6 = 4

UNKNOWN7 = * * *

UNKNOWN8 = 7

UNKNOWN9 = * * *

UNKNOWN10 = 10

UNKNOWN11 = * * *

UNKNOWN12 = 13

UNKNOWN13 = 0

UNKNOWN14 = 1

UNKNOWN15 = 2

UNKNOWN16 = 2

UNKNOWN17 = 3

UNKNOWN18 = 3

UNKNOWN19 = Pos

UNKNOWN20 = star

UNKNOWN21 = Star

UNKNOWN22 = Neg

UNKNOWN23 = Pos

UNKNOWN24 = 4

UNKNOWN25 = 22