Skip to content

Several textual KEBNF productions appear unreachable or inconsistent with release examples #124

Description

@lzy0617

Hi, I am checking the SysML v2 / KerML textual KEBNF in this repository.

I generated a simple production dependency graph from RootNamespace for the textual KEBNF files, excluding lexical whitespace/comment/reserved-token rules from the main conclusion. This found several non-lexical productions that appear to be either unreachable or wired through a different production than their own names imply.

1. SysML AllocationDefinition is defined but not reachable

SysML-textual-bnf.kebnf defines:

AllocationDefinition =
    OccurrenceDefinitionPrefix 'allocation' 'def' Definition

However, DefinitionElement includes ConnectionDefinition, FlowDefinition, InterfaceDefinition, PortDefinition, and other definition alternatives, but it does not include AllocationDefinition. Since PackageMember and DefinitionMember dispatch definitions through DefinitionElement, there appears to be no path from RootNamespace to AllocationDefinition.

Release examples use allocation definitions, for example:

  • sysml/src/validation/12-Dependency Relationships/12b-Allocation-1.sysml
  • sysml/src/training/38. Allocation/Allocation Definition Example.sysml

Minimal candidate:

allocation def A;

Suggested fix: add AllocationDefinition to DefinitionElement.

2. SysML ForVariableDeclaration is defined but bypassed

ForLoopNode reaches ForVariableDeclarationMember, but that member currently references UsageDeclaration directly:

ForLoopNode : ForLoopActionUsage =
    ActionNodePrefix
    'for' ownedRelationship += ForVariableDeclarationMember
    'in' ownedRelationship += NodeParameterMember
    ownedRelationship += ActionBodyParameterMember

ForVariableDeclarationMember : FeatureMembership =
    ownedRelatedElement += UsageDeclaration

ForVariableDeclaration : ReferenceUsage =
    UsageDeclaration

As written, ForVariableDeclaration has no incoming references. Release examples use the construct, for example sysml/src/training/20. Assignment Actions/Assignment Example.sysml contains a for vehiclePower in powerProfile action node.

Suggested fix: change ForVariableDeclarationMember to reference ForVariableDeclaration:

ForVariableDeclarationMember : FeatureMembership =
    ownedRelatedElement += ForVariableDeclaration

3. SysML MetadataUsage and its body subtree appear unreachable

The SysML KEBNF defines MetadataUsage, MetadataUsageDeclaration, MetadataBody, MetadataBodyUsageMember, and MetadataBodyUsage, but there appears to be no route from RootNamespace to MetadataUsage.

Relevant productions:

AnnotatingElement =
      Comment
    | Documentation
    | TextualRepresentation
    | MetadataFeature

MetadataUsage =
    UsageExtensionKeyword* ( '@' | 'metadata' )
    MetadataUsageDeclaration
    ...
    MetadataBody

AnnotatingElement still references the KerML-style MetadataFeature, while the SysML-specific MetadataUsage production is not included in UsageElement, AnnotatingElement, or another body dispatch production.

Release examples use full SysML metadata usages, for example:

  • sysml/src/examples/Metadata Examples/VerificationMetadataExample.sysml
  • sysml/src/examples/Metadata Examples/RiskMetadataExample.sysml
  • sysml/src/examples/Metadata Examples/RequirementMetadataExample.sysml

Minimal candidate:

package P {
    metadata def M;
    @M;
}

Suggested fix: wire MetadataUsage into the intended SysML element/body dispatch point, likely where annotating elements or usage elements are accepted, or clarify that only the prefix # form is intended in this KEBNF.

4. KerML NonFeatureChainPrimaryArgument appears to be skipped by its member production

KerML-textual-bnf.kebnf defines:

NonFeatureChainPrimaryArgumentValue : FeatureValue =
    value = NonFeatureChainPrimaryExpression

NonFeatureChainPrimaryArgument : Feature =
    ownedRelationship += NonFeatureChainPrimaryArgumentValue

NonFeatureChainPrimaryArgumentMember : ParameterMembership =
    ownedMemberParameter = PrimaryArgument

FeatureChainExpression =
    ownedRelationship += NonFeatureChainPrimaryArgumentMember '.'
    ownedRelationship += FeatureChainMember

The member name and the FeatureChainExpression context suggest that NonFeatureChainPrimaryArgumentMember should contain NonFeatureChainPrimaryArgument, but it currently contains PrimaryArgument. This leaves NonFeatureChainPrimaryArgument and NonFeatureChainPrimaryArgumentValue unreachable and also reintroduces recursion through PrimaryExpression.

Suggested fix:

NonFeatureChainPrimaryArgumentMember : ParameterMembership =
    ownedMemberParameter = NonFeatureChainPrimaryArgument

5. KerML MetaclassificationTestOperator defines @@ but is not used

MetaclassificationTestOperator is defined as:

MetaclassificationTestOperator =
    '@@'

But MetaclassificationExpression uses ClassificationTestOperator:

MetaclassificationExpression : OperatorExpression =
    ownedRelationship += MetadataArgumentMember
    ( operator = ClassificationTestOperator
      ownedRelationship += TypeReferenceMember
    | operator = MetaCastOperator
      ownedRelationship += TypeResultMember
    )
    ownedRelationship += EmptyResultMember

This makes the @@ operator production unreachable. Please confirm whether the first branch should use MetaclassificationTestOperator.

6. KerML OwnedExpressionReferenceMember is unused

OwnedExpressionReferenceMember is defined:

OwnedExpressionReferenceMember : FeatureMembership =
    ownedRelationship += OwnedExpressionReference

I could not find any production that references it. This may be harmless dead grammar, but if it is intended to be part of the expression concrete syntax, it should be connected or otherwise documented as intentionally unused.

7. End-prefixed usages appear underspecified for connection, interface, allocation, and association ends

The SysML KEBNF defines:

OccurrenceUsagePrefix : OccurrenceUsage =
    BasicUsagePrefix
    ...

DefaultReferenceUsage : ReferenceUsage =
    RefPrefix Usage

ReferenceUsage =
    ( EndUsagePrefix | RefPrefix )
    'ref' Usage

This permits end ref ..., but it does not appear to permit the end-prefixed forms used throughout the release examples, such as:

connection def C {
    end end1;
}

connection def A {
    end port p1: P;
}

allocation def LogicalToPhysical {
    end logical : LogicalElement;
}

Examples include:

  • sysml/src/examples/Simple Tests/ConnectionTest.sysml
  • sysml/src/examples/Simple Tests/ConjugationTest.sysml
  • sysml/src/training/13. Flows/Flow Definition Example.sysml
  • sysml/src/training/38. Allocation/Allocation Definition Example.sysml
  • sysml/src/examples/Association Examples/ProductSelection_OwnedEnds.sysml

Please confirm where EndUsagePrefix is intended to be accepted. Candidate fixes include allowing EndUsagePrefix in DefaultReferenceUsage, and allowing OccurrenceUsagePrefix to start with EndUsagePrefix where end occurrence usages such as end port and end item are legal.

8. EntryTransitionMember appears to require an extra source end and then

EntryTransitionMember is currently:

EntryTransitionMember : FeatureMembership =
    MemberPrefix
    ( ownedRelatedElement += GuardedTargetSuccession
    | 'then' ownedRelatedElement += TargetSuccession
    ) ';'

TargetSuccession : SuccessionAsUsage =
    ownedRelationship += SourceEndMember
    'then' ownedRelationship += ConnectorEndMember

Therefore a simple entry transition written as entry; then S1; does not match the second branch, because TargetSuccession itself still expects a source end followed by another then.

Release examples use the simple form, for example:

  • sysml/src/examples/Simple Tests/StateTest.sysml
  • sysml/src/validation/05-State-based Behavior/5-State-based Behavior-2.sysml
  • sysml/src/validation/10-Analysis and Trades/10c-Fuel Economy Analysis.sysml
  • sysml/src/training/31. Constraints/Time Constraints.sysml

Minimal candidate:

state def S {
    entry; then S1;
    state S1;
}

Suggested fix: confirm whether the second branch should reference TransitionSuccessionMember, or another single-target form, instead of TargetSuccession.

9. SatisfyRequirementUsage appears too restrictive compared with release examples

SatisfyRequirementUsage currently requires assert:

SatisfyRequirementUsage =
    OccurrenceUsagePrefix 'assert' ( isNegated ?= 'not' ) 'satisfy'
    ...

Release examples use all of the following forms:

satisfy r by p;
assert satisfy r by q;
not satisfy r1 by p;
assert not satisfy r1 by q;

Examples include:

  • sysml/src/examples/Simple Tests/RequirementTest.sysml
  • sysml/src/training/32. Requirements/Requirement Satisfaction.sysml
  • sysml/src/examples/Requirements Examples/RequirementDerivationExample.sysml
  • sysml/src/training/42. Views/Views Example.sysml

Suggested fix: make assert optional and allow not independently if these release examples are normative:

SatisfyRequirementUsage =
    OccurrenceUsagePrefix ( 'assert' )? ( isNegated ?= 'not' )? 'satisfy'
    ...

10. Case and analysis bodies appear to need return parameter members

ReturnParameterMember is currently admitted by CalculationBodyItem, but not by CaseBodyItem:

CalculationBodyItem : Type =
      ActionBodyItem
    | ownedRelationship += ReturnParameterMember

CaseBodyItem : Type =
      ActionBodyItem
    | ownedRelationship += SubjectMember
    | ownedRelationship += ActorMember
    | ownedRelationship += ObjectiveMember

Release examples use return in analysis and trade-study case bodies:

analysis def A {
    return mass;
}

analysis engineTradeStudy : TradeStudy {
    return part : Engine;
}

Examples include:

  • sysml/src/examples/Simple Tests/AnalysisTest.sysml
  • sysml/src/examples/Simple Tests/TradeStudyTest.sysml
  • sysml/src/validation/10-Analysis and Trades/10a-Analysis.sysml
  • sysml/src/training/33. Analysis/Trade Study Analysis Example.sysml

Suggested fix: either add ReturnParameterMember to CaseBodyItem, or introduce a distinct analysis/trade-study body production that permits returns.

11. Enumerated values appear unable to use prefix metadata before enum

EnumerationBody reaches EnumerationUsageMember, which uses MemberPrefix followed by EnumeratedValue:

EnumerationUsageMember : VariantMembership =
    MemberPrefix ownedRelatedElement += EnumeratedValue

EnumeratedValue : EnumerationUsage =
    'enum'? Usage

EnumerationUsage : EnumerationUsage =
    UsagePrefix 'enum' Usage

Since MemberPrefix only carries visibility, the production EnumeratedValue = 'enum'? Usage does not appear to allow a prefix metadata member before the enum keyword. However, release examples use:

#Security enum secret : ClassificationLevel = 2;

Example:

  • sysml/src/examples/Simple Tests/MetadataTest.sysml

Suggested fix: allow the EnumerationUsage concrete form for enumerated values, or otherwise permit UsagePrefix 'enum' Usage in EnumeratedValue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions