// sg.cd -- class dictionary for strategy graphs // $Id: sg.cd,v 1.12 2003/01/30 02:26:05 dougo Exp $ // package edu.neu.ccs.demeter.aplib.sg; import java.util.*; import java.io.*; import edu.neu.ccs.demeter.aplib.*; Main = . // testing stub StratSeq = Decls Sequence(StrategyExpression). Decls = "var" SList(Decl). Decl = ClassName VariableName ";". StrategyExpression = Strategy. public Strategy : SimpleStrategy. public SimpleStrategy : StrategyGraph. public StrategyGraph = "{" *l + SList(SGEdge) - *l "}". SGEdge = [ SourceMarker *s ] GlobSpec *s "->" *s [ TargetMarker *s ] GlobSpec [ *s NegativeConstraint ]. SourceMarker = "source:". TargetMarker = "target:". Constraint : NegativeConstraint common *s GlobSpec. NegativeConstraint : Bypassing | OnlyThrough. // antonyms Bypassing = "bypassing". OnlyThrough = "only-through". GlobSpec : OneGlob | GlobSet. OneGlob = Glob. GlobSet = "{" *s [ Commalist(Glob) *s ] "}". Glob : ClassGlob | EdgeGlob. EdgeGlob : PartGlob | SubclassGlob | SuperclassGlob. ClassGlob = ClassNameGlob. PartGlob = "->" *s SourceGlob "," PartNameGlob "," TargetGlob. SubclassGlob = "=>" *s SourceGlob "," TargetGlob. SuperclassGlob = ":>" *s SourceGlob "," TargetGlob. SourceGlob = ClassNameGlob. TargetGlob = ClassNameGlob. ClassNameGlob : ClassNameExact | AnyClass | ClassNameVar. ClassNameExact = ClassName. ClassNameVar = "%" Ident. AnyClass = "*". PartNameGlob : PartNameExact | AnyPart. PartNameExact = PartName. AnyPart = "*". ClassGlobSpec : OneClassGlob | ClassGlobSet. OneClassGlob = ClassGlob. ClassGlobSet = "{" *s Commalist(ClassGlob) *s "}". ClassName = Name. VariableName = "%" Ident. PartName = Ident. Name ~ Ident { "." Ident }. // Parameterized class definitions. SList(S) ~ S { *l S } . Commalist(S) ~ S {"," *s S}. Sequence(S) ~ "{" {S} "}".