diff --git a/src/main/jastadd/hanoi/Constraint.relast b/src/main/jastadd/hanoi/Constraint.relast index be33a462bc5d9d1672365e7aef35fb5cb192acf7..48932bf5b82ff1d2d09b9b2b4ff478b5460e4dfe 100644 --- a/src/main/jastadd/hanoi/Constraint.relast +++ b/src/main/jastadd/hanoi/Constraint.relast @@ -1,26 +1,49 @@ -Constraint::=Connective*; -abstract Term; -abstract Connective; -Atom:Connective ::= Relation; -abstract Relation; - -abstract BinaryRelation:Relation ::= Left:Term Right:Term; -Subsetof:BinaryRelation; -Compare:BinaryRelation; -Equal:BinaryRelation; - -abstract UnaryConnective:Connective ::= Connective; -abstract BinaryConnective:Connective ::= Left:Connective Right:Connective; -Conjunction:BinaryConnective; -Disjunction:BinaryConnective; -Implication:BinaryConnective; -Negation:UnaryConnective; - -ConstantNum:Term ::= <Num:double>; - -PillarTerm : Term ; -rel PillarTerm.Rel -> Pillar; - -Term1:PillarTerm;//return size of top disk, return -1 when no disk. -Term2:PillarTerm;//return the target pillar's ID for the current pillar in odd turns. -Term3:PillarTerm;//return the ID for the current pillar. +Constraint::=Connective*; + +abstract Term; +abstract Relation; +abstract Connective; + +abstract SelfFunction:Term; +abstract Calculation:Term; +abstract BinaryCalculation:Calculation ::= Left:Term Right:Term; +Plus:BinaryCalculation; +Minus:BinaryCalculation; +Multi:BinaryCalculation; +Divide:BinaryCalculation; +Mod:BinaryCalculation; + +IfThenElse:Term::=If:Condition Then:Term Else:Term; +abstract Condition:Term; +abstract BinaryCondition:Condition ::= Left:Term Right:Term; +SubsetofFunction:BinaryCondition; +CompareFunction:BinaryCondition; +EqualFunction:BinaryCondition; + +abstract BinaryRelation:Relation ::= Left:Term Right:Term; +Subsetof:BinaryRelation; +Compare:BinaryRelation; +Equal:BinaryRelation; + +Atom:Connective ::= Relation; +abstract UnaryConnective:Connective ::= Connective; +abstract BinaryConnective:Connective ::= Left:Connective Right:Connective; +Conjunction:BinaryConnective; +Disjunction:BinaryConnective; +Implication:BinaryConnective; +Negation:UnaryConnective; + +ConstantNum:SelfFunction ::= <Num:int>; + + +abstract PillarFunction:SelfFunction; +rel PillarFunction.Rel -> Pillar; + +PillarID:PillarFunction;//Pillar.ID returns the ID of this Pillar. +TotalDiskAmount:PillarFunction;//Pillar.AmountD() returns the amount of the disks for the game. +DisksOnPillar:PillarFunction;//Pillar.getNumDisk() returns the amount of the disks for 'this' pillar. +TopDiskSize:PillarFunction;//Pillar.getDisk(this.getRel().getNumDisk()-1).getSize(); + //return the size of the disk on the top of 'this' pillar. +Term1:PillarFunction;//return size of top disk, return -1 when no disk. +Term2:PillarFunction;//return the target pillar's ID for the current pillar in odd turns. +Term3:PillarFunction;//return the ID for the current pillar.