Acme BNF

 

BNF Meta-Syntax

Keyword                      Keywords are specified with bold text.  Keywords are case-insensitive

Non-Terminal                Non-Terminals are specified with italics

 (…)  Parentheses group tokens and productions

[…]    Indicates an optional production

(…)? Indicates a sequence of zero or one elements (synonymous with [])

(…)+ Sequence of one or more elements

(…)*  Sequence of zero or more elements

|        Seperates alternative choices

 

Acme Grammar

AcmeDesign                 ::=  ( TypeDeclaration | FamilyDeclaration   
   |  DesignAnalysisDeclaration )*
[ SystemDeclaration ]
<EOF>

 

Design Element Types:

FamilyDeclaration         ::=  Family Identifier [ "(" ")" ] "=" FamilyBody [ ";" ]

FamilyBody                  ::=  "{" ( TypeDeclaration )* "}"

TypeDeclaration            ::=  ElementTypeDeclaration | PropertyTypeDeclaration

ElementTypeDeclaration     ::=        ComponentTypeDeclaration
| ConnectorTypeDeclaration
| PortTypeDeclaration
| RoleTypeDeclaration

ComponentTypeDeclaration ::=  Component Type Identifier "=" parse_ComponentDescription  [ ";" ]
|
   Component Type Identifier Extends
   Identifier ( "," Identifier )*
   With parse_ComponentDescription [ ";" ]

ConnectorTypeDeclaration  ::=        Connector Type Identifier "="
            parse_ConnectorDescription [ ";" ]
|
  Connector Type Identifier Extends
  Identifier ( "," Identifier )*
  With parse_ConnectorDescription [ ";" ]

PortTypeDeclaration     ::=  Port Type Identifier "="
parse_PortDescription [ ";" ]
|
Port Type Identifier Extends Identifier ( "," Identifier )* With parse_PortDescription [ ";" ]

RoleTypeDeclaration     ::=  Role Type Identifier "=" parse_RoleDescription [ ";" ]
|
Role Type Identifier Extends Identifier ( "," Identifier )* with parse_RoleDescription [ ";" ]

lookup_ComponentTypeByName     ::= Identifier

lookup_ConnectorTypeByName       ::= Identifier

lookup_PortTypeByName                            ::= Identifier

lookup_RoleTypeByName                           ::= Identifier

lookup_PropertyTypeByName                     ::= Identifier

 

Design Elements:

SystemDeclaration        ::= System Identifier ( ":" Identifier )? "=" systemBody [ ";" ]

SystemBody                 ::= ( New lookup_ComponentTypeByName  |
  "{"
   ( ComponentDeclaration | ComponentsBlock
     |  ConnectorDeclaration | ConnectorsBlock
     | PortDeclaration | PortsBlock | RoleDeclaration
     | RolesBlock | PropertyDeclaration | PropertiesBlock
     | AttachmentsDeclaration | RepresentationDeclaration
     | DesignRule
  )*  
  "}"
)
[ Extended With SystemBody ]

ComponentDeclaration  ::= Component Identifier
[ ":" lookup_ComponentTypeByName ]
( "=" parse_ComponentDescription ";" | ";" )

ComponentsBlock         ::=  Components "{"
( Identifier
    [ ":" lookup_ComponentTypeByName ]
    ( "=" parse_ComponentDescription ";" | ";" )
)*
"}" [ ";" ]

parse_ComponentDescription          ::=  ( New lookup_ComponentTypeByName
      |
      "{"  ( PortDeclaration | PortsBlock
                         | PropertyDeclaration
              | PropertiesBlock
                         | RepresentationDeclaration

                         | DesignRule )*
      "}"
       )
      [ Extended With parse_ComponentDescription ]

ConnectorDeclaration    ::= Connector Identifier
[ ":" lookup_ConnectorTypeByName ]
( "=" parse_ConnectorDescription ";" | ";" )

ConnectorsBlock          ::=  Connectors "{"
( Identifier
    [ ":" lookup_ConnectorTypeByName ]
    ( "=" parse_ConnectorDescription ";" | ";" ) )*
"}" [ ";" ]

parse_ConnectorDescription  ::=   ( New lookup_ConnectorTypeByName
     |
      "{" ( RoleDeclaration | RolesBlock |
                         | PropertyDeclaration
              | PropertiesBlock
                         | RepresentationDeclaration

                         | DesignRule )*
      "}"
     )
    [ Extended With parse_ConnectorDescription ]

PortDeclaration             ::=  Port Identifier
[ ":" lookup_PortTypeByName ]
( "=" parse_PortDescription ";" | ";" )

PortsBlock                    ::= Ports "{"
( Identifier
    [ ":" lookup_PortTypeByName ]
    ( "=" parse_PortDescription ";" | ";" ) )*
 "}" [ ";" ]

parse_PortDescription   ::=  ( New lookup_PortTypeByName
  |
   "{" ( PropertyDeclaration | PropertiesBlock
          | RepresentationDeclaration | DesignRule
)*
   "}"
 )
[ Extended With parse_PortDescription ]

RoleDeclaration            ::= Role Identifier
[ ":" lookup_RoleTypeByName ]
( "=" parse_RoleDescription ";" | ";" )

RolesBlock                   ::=  Roles "{"
( Identifier
    [ ":" lookup_RoleTypeByName ]
    ( "=" parse_RoleDescription ";" | ";" ) )*
 "}" [ ";" ]

parse_RoleDescription  ::=  ( New lookup_RoleTypeByName
  | "{" ( PropertyDeclaration | PropertiesBlock |
            RepresentationDeclaration | DesignRule
)*
     "}"  )
[ Extended with parse_RoleDescription ]

AttachmentsDeclaration      ::=        [ Identifier "=" ]
Attachments "{"
( Identifier "." Identifier to Identifier "." Identifier
[ "{" ( PropertyDeclaration | PropertiesBlock )* "}" ]
";" )*
"}" ";"

 

Properties:

PropertyDeclaration      ::=  Property parse_PropertyDescription ";"

PropertiesBlock            ::=  Properties "{"
  [ parse_PropertyDescription
   
( ";" parse_PropertyDescription | ";" )*
  ]
 "}" [ ";" ]

parse_PropertyDescription  ::=        [ Property ] Identifier
":" PropertyTypeDescription
[ "=" PropertyValueDeclaration ]
[   "<<" parse_PropertyDescription
     ( ";" parse_PropertyDescription | ";" )*
    ">>"
  |
    "<<" ">>"
]

PropertyTypeDeclaration     ::=        Property Type Identifier
(  ";"
 |
   "=" ( Int ";" | Long ";" | Double ";" | Float ";"
            |String ";" | Boolean ";" | Any ";"
            |Enum [ "{" Identifier ( "," Identifier )* "}" ]  ";"
            |Set [ "{" "}" ] ";"
            |Set "{" PropertyTypeDescription "}" ";"
            |Sequence [ "<" ">" ] ";"
            |Sequence "<" PropertyTypeDescription ">" ";"
            |Record "[" parse_RecordFieldDescription
              
( ";" parse_RecordFieldDescription | ";" )* "]" ";"
            |Record [ "[" "]" ] ";"
            |Identifier ";"
         )
 )

PropertyTypeDescription     ::=        Int | Long | Float | Double | String
| Boolean | Any
| Set [ "{" [ PropertyTypeDescription ] "}" ]
| Sequence [ "<" [ PropertyTypeDescription ] ">" ]
| Record "[" parse_RecordFieldDescription
            ( ";" parse_RecordFieldDescription | ";" )* "]"
| Record [ "[" "]" ]
| Enum [ "{" Identifier ( "," Identifier )* "}" ]
| Enum [ "{" "}" ]
| Identifier

 parse_RecordFieldDescription        ::=        Identifier  ( "," Identifier  )*
            [ ":" PropertyTypeDescription ]

PropertyValueDeclaration    ::=        Integer_Literal | Floating_Point_Literal | String_Literal | False | True | AcmeSetValue | AcmeSequenceValue | AcmeRecordValue | Identifier

AcmeSetValue              ::=     "{" "}"
| "{" PropertyValueDeclaration
        ( "," PropertyValueDeclaration )* "}"

AcmeSequenceValue    ::=  "<" ">"|
"<" PropertyValueDeclaration
        ( "," PropertyValueDeclaration )* ">"

AcmeRecordValue        ::=  "[" RecordFieldValue ( ";" RecordFieldValue | ";" )* "]"

RecordFieldValue          ::=  Identifier  ":" PropertyTypeDescription  "=" PropertyValueDeclaration

 

Representations and Bindings:

RepresentationDeclaration  ::=        Representation  "{"
SystemDeclaration
[ BindingsMapDeclaration ]
"}" [ ";" ]

BindingsMapDeclaration      ::=        Bindings "=" "{" ( BindingDeclaration )* "}" [ ";" ]

BindingDeclaration        ::=  [ Identifier "." ] Identifier to 
[ Identifier "." ] Identifier
[ "{" ( PropertyDeclaration | PropertiesBlock )* "}" ] ";"

 

Design Rules and Analyses:

DesignRule                   ::=  ( Design )? ( Invariant | Heuristic ) DesignRuleExpression ";"

DesignRuleExpression  ::=  QuantifiedExpression | BooleanExpression

QuantifiedExpression    ::=  ( forall | exists | exists unique) Identifier ":" lookup_arbitraryTypeByName in
SetExpression "|" DesignRuleExpression

BooleanExpression       ::=  OrExpression ( and OrExpression )*

OrExpression               ::=  ImpliesExpression ( or ImpliesExpression )*

ImpliesExpression        ::=  IffExpression ( "->" IffExpression )*

IffExpression                ::=  EqualityExpression ( "<->" EqualityExpression )*

EqualityExpression       ::=  RelationalExpression ( "==" RelationalExpression
| "!=" RelationalExpression )*

RelationalExpression    ::=  AdditiveExpression
( "<" AdditiveExpression | ">" AdditiveExpression
 | "<=" AdditiveExpression | "=>" AdditiveExpression )*

AdditiveExpression       ::=  MultiplicativeExpression
( "+" MultiplicativeExpression
  | "-" MultiplicativeExpression )*

MultiplicativeExpression      ::=        UnaryExpression
( "*" UnaryExpression
   | "/" UnaryExpression
   | "%" UnaryExpression )*

UnaryExpression          ::=  "!" UnaryExpression
| "-" UnaryExpression
| PrimitiveExpression

PrimitiveExpression      ::=  "(" DesignRuleExpression ")"
| LiteralConstant | DesignAnalysisCall | Id

Id                                 ::=  Identifier ( "." Identifier )*

DesignAnalysisCall       ::=  Id "(" ActualParams ")"

LiteralConstant             ::= IntegerLiteral | FloatingPointLiteral | StringLiteral
| true | false

ActualParams               ::=  ( ActualParam ( "," ActualParam )* )?

FormalParams              ::=  ( FormalParam ( "," FormalParam )* )?

ActualParam                 ::=  LiteralConstant | DesignAnalysisCall | Id

FormalParam                ::=  Identifier ( "," Identifier )* ":"
(Identifier | Component | Connector | Port | Role
 | Int | Float | String | Boolean )

SetExpression              ::=  ( SetReference | SetFunction | LiteralSet
  | SetConstructor )

SetReference                ::=  Identifier ( ( "." Identifier ) | ( "." Components )
  | ( "." Connectors ) | ( "." Ports ) | ( "." Roles )
  | ( "." Representations ) | ( "." Properties )
  | ( “.” attachedRoles) | (“.” attachedPorts))+

SetFunction                  ::=  ( Union | Intersection | Setdiff )
"(" SetExpression "," SetExpression ")"

LiteralSet                      ::= ( "{" "}"  |
"{" ( LiteralConstant | Id ) ( "," ( LiteralConstant | Id ) )* "}")

SetConstructor             ::=  "{" Select Identifier ":" lookup_arbitraryTypeByName in SetExpression "|" DesignRuleExpression "}"