/* This is a cd file to describe collaborations. The same grammar is used both for core and the surface syntax; the main difference is that core is restricted; some productions are not allowed, other optional ones are required. */ import edu.neu.ccs.demeter.dj.*; import java.util.*; import java.io.*; public AC = List(Collaboration) *EOF*. public Collaboration = "collaboration" CollabName [IsACollab] ";" Structure AdapterDef. public IsACollab = "extends" CollabName. public Structure = Imports List(ParticipantDef) *l . public IsA = "extends" ParticipantName. public Impls = "implements" CommaList(ParticipantName). public HasA = JavaType VarName ";". public Imports = List(Import). public Import = "import" LongImportName ";" *l. public LongImportName = LongName. public ParticipantDef = ParticipantOrInterface ParticipantName [IsA] [Impls] *l. public ParticipantOrInterface : IsParticipant | IsInterface. public IsParticipant = "participant". public IsInterface = "interface". public AdapterDef = List(AdapterItem). // order is IMPORTANT public AdapterItem = "attach" [ CommaList(CollabRef)] AttachmentSpecList. public CollabRef : ResharedCollab | SharedCollab | NormalCollab common CollabName. public ResharedCollab = "reshared" . public SharedCollab = "shared" . public NormalCollab = "normal". public AttachmentSpecList = "{" List(Attachment) "}". public Attachment = "{" ShortName ":" + *l List(CompositeParticipantDef) - *l "}". public CompositeParticipantDef = PartSpec "+=" [ CommaList(PartSpec)] With *l. public With = "with" BracedList(Entry). Entry : Export | Around. Around = "around" ShortName ":" NameSpec "do" NameSpec . public Export = "export" NameSpec ["as" NameSpec] . List(S) ~ { S}. CommaList(S) ~ S {"," *s S}. BracedList(P) ~ "{" + *l { P } - *l "}". public PartSpec = LongName. public ShortName = Ident. public LongName ~ ShortName { "." ShortName}. public VarName = ShortName. public JavaType = LongName List(ArraySpec). public ArraySpec = "[" "]". public NameSpec = ShortName. public CollabName = LongName. public ParticipantName = ShortName. Main = .