diff --git a/Resources/SysML-graphical-bnf.kgbnf b/Resources/SysML-graphical-bnf.kgbnf
new file mode 100644
index 000000000..7d20382b8
--- /dev/null
+++ b/Resources/SysML-graphical-bnf.kgbnf
@@ -0,0 +1,2264 @@
+// Corrected manually by HP de Koning
+
+// Part 2 - Systems Modeling Language (SysML)
+
+// Clause 8.2.3 Graphical Notation
+
+// Clause 8.2.3.1 Graphical Notation Overview
+
+// Clause 8.2.3.2 Elements and Relationships Graphical Notation
+
+element =
+ dependencies-and-annotations-element
+ | general-element
+ | element-inside-textual-compartment
+
+compartment =| general-compartment
+
+general-compartment =
+
+ general-view
+
+general-view =
+ (general-element)*
+ (dependencies-and-annotations-element)*
+ (ellipsis-at-lower-left-corner)?
+
+ellipsis-at-lower-left-corner = '...'
+
+general-element =
+ general-node
+ | general-relationship
+
+element-node =
+ usage-node | definition-node | annotation-node | namespace-node
+
+element-inside-textual-compartment =
+
+
+rel-name =
+ Identification
+ | QualifiedName
+
+// Note. An element inside a textual compartment is selected by graying out a substring containing the element. The grayed-out section must cover a single element within the textual syntax inside the compartment.
+
+// Clause 8.2.3.3 Dependencies Graphical Notation
+
+dependencies-and-annotations-element =| dependencies-element
+
+dependencies-element =|
+ binary-dependency
+ | n-ary-dependency
+
+binary-dependency =
+
+
+n-ary-dependency =
+ &n-ary-association-dot (n-ary-dependency-client-or-supplier-link &element-node)+
+
+n-ary-dependency-client-or-supplier-link =
+ n-ary-dependency-client-link
+ | n-ary-dependency-supplier-link
+
+n-ary-association-dot =
+
+
+n-ary-dependency-client-link =
+
+
+n-ary-dependency-supplier-link =
+
+
+// Note. An n-ary dependency must have two or more client elements or two or more supplier elements.
+
+// Clause 8.2.3.4 Annotations Graphical Notation
+
+dependencies-and-annotations-element =|
+ annotation-node
+ | annotation-link
+
+annotation-node =
+ comment-node
+ | documentation-node
+ | textual-representation-node
+
+text-block = (LINE_TEXT)*
+
+comment-node =
+ comment-without-keyword
+ | comment-with-keyword
+
+comment-without-keyword =
+
+
+comment-with-keyword =
+
+
+documentation-node =
+
+
+documentation-compartment =
+
+ Identification
+ text-block
+
+textual-representation-node =
+
+
+language-string = 'language' STRING_VALUE
+
+annotation-link =
+
+
+annotated-element =
+ element
+ | element-inside-textual-compartment
+
+// Note. A comment node may be attached to zero, one, or more than one annotated elements. All other annotation nodes must be attached to one and only one annotated element.
+
+// Clause 8.2.3.5 Namespaces and Packages Graphical Notation
+
+general-node =| namespace-node
+
+namespace-node =| package-node
+
+package-node =
+ package-with-name-inside
+ | package-with-name-in-tab
+ | imported-package-with-name-inside
+ | imported-package-with-name-in-tab
+
+package-with-name-inside =
+
+
+package-with-name-in-tab =
+
+
+imported-package-with-name-inside =
+
+
+imported-package-with-name-in-tab =
+
+
+package-compartment =
+ general-compartment
+ | documentation-compartment
+ | packages-compartment
+ | members-compartment
+ | relationships-compartment
+
+compartment =| package-compartment
+
+packages-compartment =
+
+ packages-compartment-contents
+
+packages-compartment-contents = packages-compartment-element* '…'?
+
+packages-compartment-element = el-prefix? Identification
+
+members-compartment =
+
+ members-compartment-contents
+
+members-compartment-contents = members-compartment-element* '…'?
+
+members-compartment-element = el-prefix? (DefinitionElement | UsageElement)
+
+relationships-compartment =
+
+ relationships-compartment-contents
+
+relationships-compartment-contents = (relationships-compartment-element)* '…'?
+
+relationships-compartment-element = el-prefix? relationship-name QualifiedName
+
+relationship-name =
+ 'defines' | 'defined by' | 'specializes' | 'specialized by' | 'connect to'
+ | 'subsets' | 'subsetted by' | 'performs' | 'performed by' | 'allocated' | 'allocated to'
+ | 'satisfy' | 'satisfied by'
+
+general-relationship =|
+ import
+ | top-level-import
+ | recursive-import
+ | owned-membership
+ | unowned-membership
+
+import =
+
+
+top-level-import =
+
+
+recursive-import =
+
+
+owned-membership =
+
+
+unowned-membership =
+
+
+// Clause 8.2.3.6 Definition and Usage Graphical Notation
+
+general-node =| type-node
+
+type-node =
+ definition-node
+ | usage-node
+
+general-node =| usage-node definition-node
+
+namespace-node =| type-node
+
+definition-name-with-alias =
+ DefinitionDeclaration
+ ( '«alias»' ( QualifiedName (',' QualifiedName)* ) )?
+
+usage-name-with-alias =
+ '^'? UsageDeclaration
+ ( '«alias»' ( QualifiedName (',' QualifiedName)* ) )?
+
+compartment-stack = (compartment)*
+
+compartment =|
+ features-compartment
+ | variants-compartment
+ | variant-elementusages-compartment
+
+features-compartment =
+
+ features-compartment-contents
+
+features-compartment-contents = (features-compartment-element)* '…'?
+
+features-compartment-element = el-prefix? UsagePrefix usage-cp
+
+variants-compartment =
+
+ variants-compartment-contents
+
+variants-compartment-contents = members-compartment-contents
+
+variant-elementusages-compartment =
+
+ variants-compartment-contents
+
+general-relationship =|
+ type-relationship
+
+type-relationship =
+ subclassification
+ | subsetting
+ | definition
+ | redefinition
+ | composite-feature-membership
+ | noncomposite-feature-membership
+
+subclassification =
+
+
+definition =
+
+
+subsetting =
+
+
+reference-subsetting =
+
+
+redefinition =
+
+
+composite-feature-membership =
+
+
+noncomposite-feature-membership =
+
+
+el-prefix = '^' | '/'
+
+usage-cp = usageDeclaration ValuePart?
+
+extended-def =
+
+
+extended-def-name-compartment =
+ '«' BasicDefinitionPrefix? DefinitionExtensionKeyword+ 'def' '»'
+ definition-name-with-alias
+
+// Note. This production is only valid for cases where one or more
+// DefinitionExtensionKeyword names a MetadataDefinition that is a direct
+// or indirect specialization of KerML metaclass SemanticMetadata.
+
+definition-node =| extended-def
+
+extended-usage =
+
+
+extended-usage-name-compartment =
+ '«' BasicUsagePrefix? UsageExtensionKeyword+ '»'
+ usage-name-with-alias
+
+// Note. This production is only valid for cases where one or more
+// UsageExtensionKeyword names a MetadataDefinition that is a direct
+// or indirect specialization of KerML metaclass SemanticMetadata.
+
+usage-node =| extended-usage
+
+// Clause 8.2.3.7 Attributes Graphical Notation
+
+definition-node =| attribute-def
+
+attribute-def =
+
+
+attribute-def-name-compartment =
+ '«' DefinitionPrefix 'attribute' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| attribute
+
+attribute =
+
+
+attribute-name-compartment =
+ '«' UsagePrefix 'attribute' '»'
+ usage-name-with-alias
+
+compartment =| attributes-compartment
+
+attributes-compartment =
+
+ attributes-compartment-contents
+
+attributes-compartment-contents = (attributes-compartment-element)* '…'?
+
+attributes-compartment-element = el-prefix? UsagePrefix usage-cp
+
+// Clause 8.2.3.8 Enumerations Graphical Notation
+
+definition-node =| enumeration-def
+
+enumeration-def =
+
+
+enumeration-def-name-compartment =
+ '«' DefinitionPrefix 'enum' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| enumeration
+
+enumeration =
+
+
+enumeration-name-compartment =
+ '«' UsagePrefix 'enum' '»'
+ usage-name-with-alias
+
+compartment =| enums-compartment
+
+enums-compartment =
+
+ enums-compartment-contents
+
+enums-compartment-contents = (enums-compartment-element)* '…'?
+
+enums-compartment-element = el-prefix? UsagePrefix usage-cp
+
+// Clause 8.2.3.9 Occurrences Graphical Notation
+
+definition-node =| occurrence-def
+
+general-relationship =| portion-relationship
+
+occurrence-def =
+
+
+occurrence-def-name-compartment =
+ '«' DefinitionPrefix 'occurrence' 'def' '»'
+ definition-name-with-alias
+
+usage-node =|
+ occurrence
+ | occurrence-ref
+ | timeslice-or-snapshot-node
+
+occurrence =
+
+
+occurrence-ref =
+
+
+occurrence-name-compartment =
+ '«' OccurrenceUsagePrefix 'occurrence' '»'
+ usage-name-with-alias
+
+timeslice-or-snapshot-node =
+ timeslice
+ | snapshot
+
+timeslice =
+
+
+timeslice-name-compartment =
+ '«timeslice»'
+ usage-name-with-alias
+
+snapshot =
+
+
+snapshots-name-compartment =
+ '«snapshot»'
+ usage-name-with-alias
+
+event-occurrence-def =
+
+
+event-occurrence-def-name-compartment =
+ '«' DefinitionPrefix 'event' 'occurrence' 'def' '»'
+ definition-name-with-alias
+
+definition-node =| event-occurrence-def
+
+event-occurrence =
+
+
+event-occurrence-name-compartment =
+ '«' OccurrenceUsagePrefix 'event' 'occurrence' '»'
+ usage-name-with-alias
+
+usage-node =| event-occurrence
+
+event-edge =
+
+
+eventer = usage-node | definition-node
+
+portion-relationship =
+
+
+compartment =|
+ occurrences-compartment
+ | individuals-compartment
+ | timeslices-compartment
+ | snapshots-compartment
+ | sequence-compartment
+
+occurrences-compartment =
+
+ occurrences-compartment-contents
+
+occurrences-compartment-contents = (occurrences-compartment-element)* '…'?
+
+occurrences-compartment-element = el-prefix? OccurrenceUsagePrefix usage-cp
+
+individuals-compartment =
+
+ individuals-compartment-contents
+
+individuals-compartment-contents = (individuals-compartment-element)* '…'?
+
+individuals-compartment-element = occurrences-compartment-element
+
+timeslices-compartment =
+
+ timeslices-compartment-contents
+
+timeslices-compartment-contents = (timeslices-compartment-element)* '…'?
+
+timeslices-compartment-element = occurrences-compartment-element
+
+snapshots-compartment =
+
+ snapshots-compartment-contents
+
+snapshots-compartment-contents = (snapshots-compartment-element)* '…'?
+
+snapshots-compartment-element = occurrences-compartment-element
+
+sequence-compartment =
+
+ sequence-view
+
+sequence-view = (sq-graphical-element)*
+
+sq-graphical-element =
+ sq-graphical-node
+ | sq-graphical-relationship
+ | dependencies-and-annotations-element
+
+sq-graphical-node = sq-head-node | lifeline
+
+sq-head-node = sq-part | sq-port
+
+sq-part =
+
+
+sq-port =
+
+
+sq-port-label = UsageDeclaration
+
+sq-l-node =
+ lifeline
+ | sq-proxy
+
+lifeline =
+
+
+sq-proxy =
+
+ |
+
+
+proxy-label = '.'? FeatureChainMember
+
+sq-graphical-relationship = message | sq-succession
+
+succession-label = UsageDeclaration?
+
+sq-succession =
+
+
+succession-label = Identification
+
+// Note: the proxy nodes attached to a succession must refer to an event
+
+// Clause 8.2.3.10 Items Graphical Notation
+
+definition-node =| item-def
+
+interconnection-element =| item| item-ref
+
+item-def =
+
+
+item-def-name-compartment =
+ '«' DefinitionPrefix 'item' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| item
+
+item =
+
+
+item-name-compartment =
+ '«' OccurrenceUsagePrefix 'item' '»'
+ usage-name-with-alias
+
+item-ref =
+
+
+compartment =| items-compartment
+
+items-compartment =
+
+ items-compartment-contents
+
+items-compartment-contents = (items-compartment-element)* '…'
+
+items-compartment-element = el-prefix? OccurrenceUsagePrefix usage-cp
+
+// Clause 8.2.3.11 Parts Graphical Notation
+
+definition-node =| part-def
+
+interconnection-element =| part | part-ref
+
+part-def =
+
+
+part-def-name-compartment =
+ '«' DefinitionPrefix 'part' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| part
+
+part =
+
+
+part-name-compartment =
+ '«' OccurrenceUsagePrefix 'part' '»'
+ usage-name-with-alias
+
+part-ref =
+
+
+compartment =|
+ parts-compartment
+ | directed-features-compartment
+ | interconnection-compartment
+
+parts-compartment =
+
+ parts-compartment-contents
+
+parts-compartment-contents = (parts-compartment-element)* '…'?
+
+parts-compartment-element = el-prefix? OccurrenceUsagePrefix usage-cp
+
+directed-features-compartment =
+
+ directed-features-compartment-contents
+
+directed-features-compartment-contents = (directed-features-compartment-element)* '…'?
+
+directed-features-compartment-element =
+ el-prefix FeatureDirection DefinitionBodyItem*
+
+interconnection-compartment =
+
+ interconnection-view
+
+interconnection-view =|
+ (interconnection-element)*
+ (dependencies-and-annotations-element)*
+ (ellipsis-at-lower-left-corner)?
+
+general-view =| interconnection-view
+
+// Clause 8.2.3.12 Ports Graphical Notation
+
+definition-node =| port-def
+
+port-def =
+
+
+port-def-name-compartment =
+ '«' DefinitionPrefix 'port' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| port-usage
+
+port-usage =
+
+
+port-name-compartment =
+ '«' OccurrenceUsagePrefix 'port' '»'
+ usage-name-with-alias
+
+compartment =| ports-compartment
+
+ports-compartment =
+
+ ports-compartment-contents
+
+ports-compartment-contents = (ports-compartment-element)* '…'?
+
+ports-compartment-element = el-prefix? OccurrenceUsagePrefix usage-cp
+
+interconnection-element =| port-def | port-usage
+
+pdh =
+
+ |
+
+ |
+
+
+pdv =
+
+ |
+
+ |
+
+
+port-l =
+
+ |
+
+ |
+
+ |
+ proxy-v
+
+port-r =
+
+ |
+
+ |
+
+ |
+ proxy-v
+
+port-t =
+
+ |
+
+ |
+
+ |
+ proxy-h
+
+port-b =
+
+ |
+
+ |
+
+ |
+ proxy-h
+
+port-label = QualifiedName (':' QualifiedName)?
+
+proxy-v =
+
+ |
+
+
+proxy-h =
+
+ |
+
+
+// Note. Dotted line port productions (references) are only possible for nested ports
+
+// Note. The proxy option of a port production is valid only on a part usage contained within an interconnection view.
+
+// Clause 8.2.3.13 Connections Graphical Notation
+
+definition-node =| connection-def
+
+connection-def =
+
+
+connection-def-name-compartment =
+ '«' DefinitionPrefix 'connection' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| connection
+
+connection =
+
+
+connection-name-compartment =
+ '«' OccurrenceUsagePrefix 'connection' '»'
+ usage-name-with-alias
+
+compartment =| connections-compartment
+
+connections-compartment =
+
+ connections-compartment-contents
+
+connections-compartment-contents = (connections-compartment-element)* '…'?
+
+connections-compartment-element =
+ el-prefix? OccurrenceUsagePrefix UsageDeclaration
+
+interconnection-element =|
+ connection-def
+ | connection
+ | connection-relationship
+ | attribute
+
+connection-relationship =
+ binding-connection
+ | connection-graphical
+ | n-ary-connection
+ | n-ary-connection-def
+ | connection-definition-elaboration
+ | connection-usage-elaboration
+ | connection-def-graphical
+
+connection-graphical =
+
+ |
+
+
+c-adornment =
+ (a-property | a-direction | a-subsetting |a-redefinition)*
+
+a-property =
+ 'ordered' | 'nonunique' | 'abstract' | 'derived' | 'readonly'
+
+a-direction =
+ 'in' | 'out' | 'inout'
+
+a-subsetting =
+ 'subsets' OwnedSubsetting (',' OwnedSubsetting)*
+
+a-redefinition =
+ 'redefines' OwnedRedefinition (',' OwnedRedefinition)*
+
+connection-end = usage-node | usage-edge
+
+usage-edge =| connection-graphical | binding-connection
+
+connection-label = UsageDeclaration
+
+connection-def-graphical =
+
+ |
+
+
+general-relationship =| connection-def-graphical
+
+cdef-label = Identification
+
+n-ary-connection-def =
+ n-ary-def-connection-dot n-ary-def-segment+
+
+n-ary-def-connection-dot =
+
+
+n-ary-def-segment =
+
+
+definition-node =| n-ary-def-connection-dot
+
+general-relationship =| n-ary-def-segment
+
+n-ary-connection =
+ n-ary-connection-dot n-ary-segment+
+
+n-ary-connection-dot =
+
+
+usage-node =| n-ary-connection-dot
+
+cdot-label = UsageDeclaration
+
+n-ary-segment =
+
+
+binding-connection =
+
+
+rolename = Identification?
+
+multiplicity = MultiplicityRange?
+
+connection-definition-elaboration =
+
+
+connection-usage-elaboration =
+
+
+// Note. The usage-nodes at the ends of a binding-connection must be of compatible types.
+
+// Clause 8.2.3.14 Interfaces Graphical Notation
+
+definition-node =| interface-def
+
+interconnection-element =| interface
+
+interface-def =
+
+
+interface-def-name-compartment =
+ '«' DefinitionPrefix 'interface' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| interface
+
+interface =
+
+
+interface-name-compartment =
+ '«' OccurrenceUsagePrefix 'interface' '»'
+ usage-name-with-alias
+
+compartment =|
+ interfaces-compartment
+ | ends-compartment
+
+interfaces-compartment =
+
+ interfaces-compartment-contents
+
+interfaces-compartment-contents = (interfaces-compartment-element)* '…'?
+
+interfaces-compartment-element =
+ el-prefix? OccurrenceUsagePrefix InterfaceUsageDeclaration
+
+ends-compartment =
+
+ ends-compartment-contents
+
+ends-compartment-contents = (ends-compartment-element)* '…'?
+
+ends-compartment-element = QualifiedName (':' QualifiedName)?
+
+connection-relationship =|
+ interface-connection
+
+interface-connection =
+
+
+interface-label = UsageDeclaration?
+
+// Clause 8.2.3.15 Allocations Graphical Notation
+
+definition-node =| allocation-def
+
+allocation-def =
+
+
+allocation-def-name-compartment =
+ '«' DefinitionPrefix 'allocation' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| allocation
+
+allocation =
+
+
+allocation-name-compartment =
+ '«' OccurrenceUsagePrefix 'allocation' '»'
+ usage-name-with-alias
+
+compartment =| allocations-compartment
+
+allocations-compartment =
+
+ allocations-compartment-contents
+
+allocations-compartment-contents = (allocations-compartment-element)* '…'?
+
+allocations-compartment-element =
+ el-prefix? OccurrenceUsagePrefix AllocationUsageDeclaration UsageBody*
+
+general-relationship =| allocate-relationship
+
+allocate-relationship =
+
+
+allocation-node =
+ general-node
+ | element-in-textual-compartment
+
+usage-edge =| allocate-relationship
+
+// Clause 8.2.3.16 Flows Graphical Notation
+
+definition-node =| flow-def
+
+flow-def =
+
+
+flow-def-name-compartment =
+ '«' DefinitionPrefix 'succession'? 'flow' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| flow-node
+
+flow-node =
+
+
+flow-name-compartment =
+ '«' OccurrenceUsagePrefix ( 'message' | 'succession'? 'flow' ) '»'
+ usage-name-with-alias
+
+compartment =| flows-compartment
+
+flows-compartment =
+
+ flows-compartment-contents
+
+flows-compartment-contents = (flows-compartment-element)* '...'?
+
+flows-compartment-element =
+ el-prefix? OccurrenceUsagePrefix
+ ( 'message' MessageDeclaration
+ | 'succession'? FlowDeclaration
+ )
+
+interconnection-element =|
+ flow-def
+ | flow
+
+connection-relationship =|
+ message-connection
+ | flow
+ | succession-flow
+ | flow-on-connection
+
+usage-edge =| message | flow | succession-flow
+
+msg-end-node =
+ occurrence| sq-l-node| item | part | port | action | state
+ | use-case | verification-case | analysis-case | proxy
+
+message =
+
+
+// Note: proxy nodes and ends of messages must refer to occurrences
+
+message-label =
+ UsageDeclaration? ('of' FlowPayloadFeatureMember)? | FlowPayloadFeatureMember
+
+flow =
+
+
+flow-label =
+ UsageDeclaration? ('of' FlowPayloadFeatureMember)? | FlowPayloadFeatureMember
+
+flow-end-node =
+ parameter | proxy
+
+// Note: proxy nodes at ends of flows must refer to directed features
+
+succession-flow =
+
+
+succession-flow-label = flow-label
+
+flow-on-connection =
+
+
+flow-node =
+ flow-node-r
+ | flow-node-l
+ | sflow-node-r
+ | sflow-node-l
+ | message-node-r
+ | message-node-l
+
+flow-node-r =
+
+
+flow-node-l =
+
+
+sflow-node-r =
+
+
+sflow-node-l =
+
+
+message-node-r =
+
+
+message-node-l =
+
+
+flow-label =
+ Identification | FlowPayloadFeatureMember
+
+// Clause 8.2.3.17 Actions Graphical Notation
+
+definition-node =| action-def
+
+action-def =
+
+
+action-def-name-compartment =
+ '«' DefinitionPrefix 'action' 'def' '»'
+ definition-name-with-alias
+
+usage-node =|
+ action
+ | perform-action-usage
+
+action =
+
+
+action-name-compartment =
+ '«' OccurrenceUsagePrefix 'action' '»'
+ usage-name-with-alias
+
+perform-action-usage =
+
+
+action-ref =
+
+
+perform-action-name-compartment =
+ '«' OccurrenceUsagePrefix 'perform' 'action' '»'
+ usage-name-with-alias
+
+compartment =|
+ actions-compartment
+ | perform-actions-compartment
+ | parameters-compartment
+ | action-flow-compartment
+
+actions-compartment =
+
+ actions-compartment-contents
+
+actions-compartment-contents = (actions-compartment-element)* '…'?
+
+actions-compartment-element =
+ el-prefix? OccurrenceUsagePrefix ActionUsageDeclaration
+
+perform-actions-compartment =
+
+ perform-actions-compartment-contents
+
+perform-actions-compartment-contents = (perform-actions-compartment-element)* '…'?
+
+perform-actions-compartment-element =
+ el-prefix? OccurrenceUsagePrefix PerformActionUsageDeclaration
+
+parameters-compartment =
+
+ parameters-compartment-contents
+
+parameters-compartment-contents = (parameters-compartment-element)* '…'?
+
+parameters-compartment-element =
+ el-prefix? FeatureDirection UsageDeclaration ValueOrFlowPart? DefinitionBodyItem*
+
+performed-by-compartment =
+
+ performed-by-compartment-contents
+
+performed-by-compartment-contents = QualifiedName* '…'?
+
+action-flow-compartment =
+
+ action-flow-view
+
+action-flow-view =
+ (dependencies-and-annotations-element)*
+ (action-flow-element)*
+ (perform-action-swimlanes)?
+
+action-flow-element =|
+ action-ref
+ | action
+ | action-flow-node
+ | action-flow-relationship
+
+action-flow-node =
+ start-node
+ | done-node
+ | terminate-node
+ | fork-node
+ | join-node
+ | decision-node
+ | merge-node
+ | send-action-node
+ | accept-action-node
+ | while-loop-action-node
+ | for-loop-action-node
+ | if-else-action-node
+ | assign-action-node
+
+action-flow-relationship =
+ flow
+ | aflow-succession
+ | binding-connection
+ | else-branch
+
+param-l =
+
+ |
+
+ |
+ proxy-v
+
+param-r =
+
+ |
+
+ |
+ proxy-v
+
+param-t =
+
+ |
+
+ |
+ proxy-h
+
+param-b =
+
+ |
+
+ |
+ proxy-h
+
+param-label = QualifiedName (':' QualifiedName)*
+
+start-node =
+
+
+done-node =
+
+
+terminate-node =
+
+
+fork-node =
+
+
+join-node =
+
+
+decision-node =
+
+
+merge-node =
+
+
+send-action-node =
+
+
+send-action-name-compartment =
+ '«' OccurrenceUsagePrefix 'send' 'action' '»'
+ usage-name-with-alias
+
+send-action-expression = NodeParameterMember 'to' NodeParameterMember
+
+accept-action-node =
+
+
+accept-action-name-compartment =
+ '«' OccurrenceUsagePrefix 'accept' 'action' '»'
+ usage-name-with-alias
+
+accept-action-expression = AcceptParameterPart
+
+while-loop-action-node =
+
+
+while-condition =
+
+ condition-expression
+
+until-condition =
+
+ condition-expression
+
+while-loop-action-name-compartment =
+ '«' OccurrenceUsagePrefix 'loop' '»'
+ usage-name-with-alias
+
+for-loop-action-node =
+
+
+iteration =
+
+ iteration-expression
+
+loop-body =
+
+ action-body
+
+for-loop-action-name-compartment =
+ '«' OccurrenceUsagePrefix 'loop' '»'
+ usage-name-with-alias
+
+if-else-action-node =
+
+
+if-condition =
+
+ condition-expression
+
+then-body =
+
+ action-body
+
+else-body =
+
+ action-body
+
+ifelse-action-name-compartment =
+ '«' OccurrenceUsagePrefix 'if' '»'
+ usage-name-with-alias
+
+action-body =
+ action-body-textual | action-flow-view
+
+condition-expression =
+ ExpressionParameterMember
+
+iteration-expression =
+ ForVariableDeclarationMember 'in' NodeParameterMember
+
+action-body-textual =
+ ActionBodyParameterMember
+
+assign-action-node =
+
+
+assign-action-name-compartment =
+ '«' OccurrenceUsagePrefix 'assign' '»'
+ usage-name-with-alias
+
+perform-actions-swimlanes = (swimlane)*
+
+swimlane =
+
+
+parameter =
+ param-l | param-r | param-t | param-b
+
+aflow-succession =
+
+
+else-branch =
+
+
+perform-edge =
+
+
+performer-node = part | action | part-def | action-def | distinguished-parameter
+
+usage-edge =| succession perform-edge
+
+guard-expression = '[' OwnedExpression ']'
+
+// Note. All swimlanes are attached to each other on vertical edges and aligned along the top and bottom horizontal edges.
+
+// Note. The proxy option of a parameter production is valid only on an action usage contained within an action flow view.
+
+// Clause 8.2.3.18 States Graphical Notation
+
+definition-node =| state-def
+
+state-def =
+
+
+state-def-name-compartment =
+ '«' DefinitionPrefix 'state' 'def' '»'
+ definition-name-with-alias
+ ('«' 'parallel' '»')?
+
+usage-node =|
+ state
+ | exhibit-state-usage
+
+state =
+
+
+state-ref =
+
+
+state-name-compartment =
+ '«' OccurrenceUsagePrefix 'state' '»'
+ usage-name-with-alias
+ ('«' 'parallel' '»')?
+
+exhibit-state-usage =
+
+
+state-subaction-body = state-subaction-body-textual | action-flow-view
+
+state-subaction-body-textual = state-subaction-declaration? ( '{' ActionBodyItem* '}' )?
+
+state-subaction-declaration =
+ PerformActionUsageDeclaration
+ | AcceptNodeDeclaration
+ | SendNodeDeclaration
+ | AssignmentNodeDeclaration
+
+state-do-action =
+
+ state-subaction-body
+
+state-entry-action =
+
+ state-subaction-body
+
+state-exit-action =
+
+ state-subaction-body
+
+entry-action =
+
+ |
+
+
+entry-action-name-comp =
+ '«' 'entry' OccurrenceUsagePrefix 'action' '»'
+ usage-name-with-alias
+
+exit-action =
+
+
+exit-action-name-comp =
+ '«' 'exit' OccurrenceUsagePrefix 'action' '»'
+ usage-name-with-alias
+
+do-action =
+
+
+do-action-name-comp =
+ '«' 'do' OccurrenceUsagePrefix 'action' '»'
+ usage-name-with-alias
+
+exhibit-state-name-compartment =
+ '«exhibit-state»'
+ state-name-compartment
+
+compartment =|
+ states-compartment
+ | state-actions-compartment
+ | exhibit-states-compartment
+ | successions-compartment
+ | state-transition-compartment
+
+states-compartment =
+
+ states-compartment-contents
+
+states-compartment-contents = (states-compartment-element)* '…'?
+
+states-compartment-element =
+ el-prefix? OccurrenceUsagePrefix ActionUsageDeclaration
+
+state-actions-compartment =
+
+ state-actions-compartment-contents
+
+state-actions-compartment-contents = (state-actions-compartment-element)* '…'?
+
+state-actions-compartment-element =
+ el-prefix? EntryActionMember | DoActionMember | ExitActionMember
+
+exhibit-states-compartment =
+
+ exhibit-states-compartment-contents
+
+exhibit-states-compartment-contents = exhibit-state-scompartment-element* '…'?
+
+exhibit-states-compartment-element-compartment = UsageDeclaration
+
+successions-compartment =
+
+ successions-compartment-contents
+
+successions-compartment-contents = QualifiedName* '…'?
+
+state-transition-compartment =
+
+ state-transition-view
+
+state-transition-view =
+ (state-transition-element)*
+ (dependencies-and-annotations-element)*
+
+state-transition-element =
+ state-transition-node
+ | transition
+ | st-succession
+
+state-transition-node =
+ state
+ | state-ref
+ | start-node
+ | entry-action
+ | do-action
+ | exit-action
+ | done-node
+ | fork-node
+ | join-node
+ | decision-node
+ | merge-node
+ | terminate-node
+ | action
+ | perform-action-usage
+ | action-ref
+
+transition =
+
+ |
+
+
+state-source =
+ state | state-ref
+
+transition-label = trigger-expression '/' ActionUsage
+
+trigger-expression = AcceptParameterPart (guard-expression)?
+
+st-succession =
+
+ |
+
+
+exhibit-edge =
+
+
+exhibitor = part | part-def
+
+general-relationship =| exhibit-edge
+
+usage-edge =| transition | st-succession | exhibit-edge
+
+// Clause 8.2.3.19 Calculations Graphical Notation
+
+definition-node =| calc-def
+
+calc-def =
+
+
+calc-def-name-compartment =
+ '«' DefinitionPrefix 'calc' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| calc
+
+calc =
+
+
+calc-name-compartment =
+ '«' OccurrenceUsagePrefix 'calc' '»'
+ usage-name-with-alias
+
+action-flow-element =|
+ calc-def
+ | calc
+
+compartment =|
+ calcs-compartment
+ | result-compartment
+
+calcs-compartment =
+
+ calcs-compartment-contents
+
+calcs-compartment-contents = calcs-compartment-element* '…'?
+
+calcs-compartment-element = el-prefix? OccurrenceUsagePrefix ActionUsageDeclaration
+
+result-compartment =
+
+ result-compartment-contents
+
+result-compartment-contents = OwnedExpression
+
+// Clause 8.2.3.20 Constraints Graphical Notation
+
+definition-node =| constraint-def
+
+constraint-def =
+
+
+constraint-def-name-compartment =
+ '«' DefinitionPrefix 'constraint' 'def' '»'
+ definition-name-with-alias
+
+usage-node =
+ constraint
+ | assert-constraint-node
+
+constraint =
+
+
+constraint-ref =
+
+
+constraint-name-compartment =
+ '«' OccurrenceUsagePrefix 'constraint' '»'
+ usage-name-with-alias
+
+assert-constraint-node =
+
+
+assert-constraint-name-compartment =
+ '«assert constraint»'
+ constraint-name-compartment
+
+assume-constraint-node =
+
+
+assume-constraint-name-compartment =
+ '«' OccurrenceUsagePrefix 'assume' 'constraint' '»'
+ usage-name-with-alias
+
+usage-node =| assume-constraint-node | assert-constraint-node
+
+assume-edge =
+
+
+assumer = requirement | requirement-def
+
+general-relationship =| assume-edge
+
+assert-edge =
+
+
+assertor = usage-node | definition-node
+
+general-relationship =| assert-edge
+
+compartment =|
+ constraints-compartment
+ | assert-constraints-compartment
+
+constraints-compartment =
+
+ constraints-compartment-contents
+
+constraints-compartment-contents = (constraints-usage-compartment-element)* '…'?
+
+constraints-usage-compartment-element =
+ el-prefix? OccurrenceUsagePrefix ConstraintUsageDeclaration CalculationBody*
+
+assert-constraints-compartment =
+
+ assert-constraints-compartment-contents
+
+assert-constraints-compartment-contents = (assert-constraints-compartment-element)* '…'?
+
+assert-constraints-compartment-element =
+ el-prefix? OccurrenceUsagePrefix ( 'not' )?
+ ( OwnedSubsetting FeatureSpecializationPart? | UsageDeclaration )
+ CalculationUsageParameterPart CalculationBody
+
+interconnection-element =|
+ constraint-ref
+ | constraint
+
+// Clause 8.2.3.21 Requirements Graphical Notation
+
+definition-node =|
+ requirement-def
+ | concern-def
+
+requirement-def =
+
+
+requirement-def-name-compartment =
+ '«' DefinitionPrefix 'requirement' 'def' '»'
+ definition-name-with-alias
+
+usage-node =
+ requirement
+ | satisfy-requirement-usage
+ | concern
+
+requirement =
+
+
+requirement-ref =
+
+
+requirement-name-compartment =
+ '«' OccurrenceUsagePrefix 'requirement' '»'
+ usage-name-with-alias
+
+satisfy-requirement-usage =
+
+
+satisfy-requirement-name-compartment =
+ '«satisfy requirement»'
+ requirement-name-compartment
+
+concern-def =
+
+
+concern-def-name-compartment =
+ '«' DefinitionPrefix 'concern' 'def' '»'
+ definition-name-with-alias
+
+concern =
+
+
+concern-name-compartment =
+ '«' OccurrenceUsagePrefix 'concern' '»'
+ usage-name-with-alias
+
+compartment =|
+ constraints-compartment
+ | assert-constraints-compartment
+
+compartment =|
+ requirements-compartment
+ | require-constraints-compartment
+ | assume-constraints-compartment
+ | satisfy-requirements-compartment
+ | satisfies-compartment
+ | actors-compartment
+ | subject-compartment
+ | stakeholders-compartment
+ | frames-compartment
+
+requirements-compartment =
+
+ requirements-compartment-contents
+
+requirements-compartment-contents = (requirements-compartment-element)* '…'?
+
+requirements-compartment-element =
+ OccurrenceUsagePrefix ConstraintUsageDeclaration
+
+require-constraints-compartment =
+
+ require-constraints-compartment-contents
+
+require-constraints-compartment-contents = require-constraint-element* '…'?
+
+require-constraint-element =
+ el-prefix? requireMemberPrefix? RequirementConstraintUsage
+
+assume-constraints-compartment =
+
+ assume-constraints-compartment-contents
+
+assume-constraints-compartment-contents = require-constraint-element* '…'?
+
+satisfy-requirements-compartment =
+
+ satisfy-requirements-compartment-contents
+
+satisfy-requirements-compartment-contents = text-block
+
+satisfies-compartment =
+
+ satisfies-compartment-contents
+
+satisfies-compartment-contents = UsageDeclaration* '…'?
+
+actors-compartment =
+
+ actors-compartment-contents
+
+actors-compartment-contents = (actors-compartment-element)* '…'?
+
+actors-compartment-element = el-prefix? MemberPrefix usage-cp
+
+subject-compartment =
+
+ subject-compartment-contents
+
+subject-compartment-contents = (subject-compartment-element)* '…'?
+
+subject-compartment-element = el-prefix? MemberPrefix usage-cp
+
+stakeholders-compartment =
+
+ stakeholders-compartment-contents
+
+stakeholders-compartment-contents = (stakeholders-compartment-element)* '…'?
+
+stakeholders-compartment-element = el-prefix? MemberPrefix usage-cp
+
+frames-compartment =
+
+ frames-compartment-contents
+
+frames-compartment-contents = (frames-compartment-element)* '…'?
+
+frames-compartment-element = el-prefix* MemberPrefix? FramedConcernUsage
+
+concerns-compartment =
+
+ concerns-compartment-contents
+
+interconnection-element =|
+ requirement-ref
+ | requirement
+ | concern
+ | distinguished-parameter
+ | distinguished-parameter-link
+ | concern-stakeholder-link
+
+general-relationship =| frame-relationship
+
+subject-actors-stakeholders-node =| requirement
+
+distinguished-parameter =
+ subject
+ | actor
+ | stakeholder
+
+subject =
+
+
+actor =
+
+ |
+
+
+stakeholder =
+
+
+subject-name = UsageDeclaration
+
+actor-name = UsageDeclaration
+
+stakeholder-name = UsageDeclaration
+
+distinguished-parameter-link =
+
+
+frame-relationship =
+
+
+concern-stakeholder-link =
+
+
+satisfy-edge =
+
+
+satisfier = usage-node | definition-node
+
+general-relationship =| satisfy-edge
+
+require-edge =
+
+
+requirer = usage-node | definition-node
+
+general-relationship =| require-edge
+
+require-constraint-node =
+
+
+require-constraint-name-compartment =
+ '«' OccurrenceUsagePrefix 'require' 'constraint' '»'
+ usage-name-with-alias
+
+usage-node =| require-constraint-node
+
+frame-concern-node =
+
+
+frame-concern-name-compartment =
+ '«' OccurrenceUsagePrefix 'frame' 'concern' '»'
+ usage-name-with-alias
+
+usage-node =| frame-concern-node
+
+frame-edge =
+
+
+framer = requirement | requirement-def | viewpoint | viewpoint-def
+
+general-relationship =| frame-edge
+
+// Clause 8.2.3.22 Cases Graphical Notation
+
+compartment =| objective-compartment
+
+objective-compartment =
+
+ objective-compartment-contents
+
+objective-compartment-contents = (objective-compartment-element)* '…'?
+
+objective-compartment-element =
+ comp-prefix? MemberPrefix ConstraintUsageDeclaration RequirementBody
+
+// Clause 8.2.3.23 Analysis Cases Graphical Notation
+
+definition-node =| analysis-def
+
+analysis-def =
+
+
+analysis-def-name-compartment =
+ '«' DefinitionPrefix 'analysis' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| analysis
+
+analysis =
+
+
+analysis-name-compartment =
+ '«' OccurrenceUsagePrefix 'analysis' '»'
+ usage-name-with-alias
+
+compartment =| analyses-compartment
+
+analyses-compartment =
+
+ analyses-compartment-contents
+
+analyses-compartment-contents = analyses-compartment-element* '…'?
+
+analyses-compartment-element =
+ el-prefix? OccurrenceUsagePrefix ConstraintUsageDeclaration CaseBody
+
+action-flow-element =|
+ analysis-def
+ | analysis
+
+subject-actors-stakeholders-node =| analysis | analysis-def
+
+// Clause 8.2.3.24 Verification Cases Graphical Notation
+
+definition-node =| verification-def
+
+verification-def =
+
+
+verification-def-name-compartment =
+ '«' DefinitionPrefix 'verification' 'def' '»'
+ definition-name-with-alias
+
+usage-node =| verification
+
+verification =
+
+
+verification-name-compartment =
+ '«' OccurrenceUsagePrefix 'verification' '»'
+ usage-name-with-alias
+
+verify-requirement-node =
+
+
+verify-requirement-name-compartment =
+ '«' OccurrenceUsagePrefix 'verify' 'requirement' '»'
+ usage-name-with-alias
+
+usage-node =| verify-requirement-node
+
+compartment =|
+ verifications-compartment
+ | verifies-compartment
+ | verification-methods-compartment
+
+verifications-compartment =
+
+ verifications-compartment-contents
+
+verifications-compartment-contents = (verifications-compartment-element)* '…'?
+
+verifications-compartment-element =
+ el-prefix? OccurrenceUsagePrefix ConstraintUsageDeclaration CaseBody '…'
+
+verifies-compartment =
+
+ verifies-compartment-contents
+
+verifies-compartment-contents = (verifies-compartment-element)* '…'?
+
+verifies-compartment-element = el-prefix? MemberPrefix RequirementVerificationUsage '…'
+
+verification-methods-compartment =
+
+ verification-methods-compartment-contents
+
+verification-methods-compartment-contents = (verification-methods-compartment-element)* '…'?
+
+verification-methods-compartment-element = MetadataBody
+
+action-flow-element =|
+ verification-def
+ | verification
+
+general-relationship =| verify-relationship
+
+verify-relationship =
+
+
+subject-actors-stakeholders-node =| verification | verification-def
+
+// Clause 8.2.3.25 Use Cases Graphical Notation
+
+definition-node =| use-case-def
+
+use-case-def =
+
+
+use-case-def-name-compartment =
+ '«' DefinitionPrefix 'use' 'case' 'def' '»'
+ definition-name-with-alias
+
+usage-node =|
+ use-case
+ | include-use-case-usage
+
+use-case =
+
+
+use-case-name-compartment =
+ '«' OccurrenceUsagePrefix 'use' 'case' '»'
+ usage-name-with-alias
+
+include-use-case-usage =
+
+
+include-use-case-name-compartment =
+ '«include use case»'
+ requirement-name-compartment
+
+compartment =|
+ use-cases-compartment
+ | include-actions-compartment
+ | includes-compartment
+
+use-cases-compartment =
+
+ use-cases-compartment-contents
+
+use-cases-compartment-contents = use-cases-compartment-element* '…'?
+
+use-cases-compartment-element = el-prefix? OccurrenceUsagePrefix ConstraintUsageDeclaration
+
+include-use-cases-compartment =
+
+ include-use-cases-compartment-contents
+
+include-use-cases-compartment-contents = (include-use-cases-compartment-element)* '…'?
+
+include-use-cases-compartment-element =
+ el-prefix? OccurrenceUsagePrefix
+ ( OwnedSubsetting FeatureSpecializationPart? | UsageDeclaration )
+ ( ValuePart | ActionUsageParameterList )? CaseBody
+
+includes-compartment =
+
+ includes-compartment-contents
+
+includes-compartment-contents = (includes-compartment-element)* '…'?
+
+includes-compartment-element =
+ el-prefix? OccurrenceUsagePrefix
+ ( OwnedSubsetting FeatureSpecializationPart? | UsageDeclaration )
+
+action-flow-element =|
+ use-case-def
+ | use-case
+
+general-relationship =| include-use-case-relationship
+
+include-use-case-relationship =
+
+
+subject-actors-stakeholders-node =| use-case | use-case-def
+
+// Clause 8.2.3.26 Views and Viewpoints Graphical Notation
+
+root-view =
+ framed-view
+
+definition-node =|
+ viewpoint-def
+ | view-def
+
+viewpoint-def =
+
+
+viewpoint-def-name-compartment =
+ '«' DefinitionPrefix 'viewpoint' 'def' '»'
+ definition-name-with-alias
+
+view-def =
+
+
+view-def-name-compartment =
+ '«' DefinitionPrefix 'view' 'def' '»'
+ definition-name-with-alias
+
+usage-node =|
+ viewpoint
+ | view
+ | framed-view
+
+viewpoint =
+
+
+viewpoint-name-compartment =
+ '«' OccurrenceUsagePrefix 'viewpoint' '»'
+ usage-name-with-alias
+
+view =
+
+
+view-name-compartment =
+ '«' OccurrenceUsagePrefix 'view' '»'
+ usage-name-with-alias
+
+compartment =|
+ views-compartment
+ | viewpoints-compartment
+ | exposes-compartment
+ | filters-compartment
+ | rendering-compartment
+
+views-compartment =
+
+ views-compartment-contents
+
+views-compartment-contents = (views-compartment-element)* '…'
+
+views-compartment-element =
+ el-prefix? OccurrenceUsagePrefix UsageDeclaration? ValueOrFlowPart? ViewBody
+
+viewpoints-compartment =
+
+ viewpoints-compartment-contents
+
+viewpoints-compartment-contents = (viewpoints-compartment-element)* '…'?
+
+viewpoints-compartment-element =
+ el-prefix? OccurrenceUsagePrefix ConstraintUsageDeclaration RequirementBody
+
+exposes-compartment =
+
+ exposes-compartment-contents
+
+exposes-compartment-contents = exposes-compartment-element* '…'?
+
+exposes-compartment-element = MembershipExpose | NamespaceExpose
+
+filters-compartment =
+
+ filters-compartment-contents
+
+filters-compartment-contents = (filters-compartment-element)* '…'?
+
+filters-compartment-element = el-prefix? MemberPrefix OwnedExpression
+
+rendering-compartment =
+
+ rendering-compartment-contents
+
+rendering-compartment-contents = usage-cp* '…'?
+
+interconnection-element =|
+ viewpoint-def
+ | viewpoint
+ | view-def
+ | view
+
+framed-view =
+
+
+frameless-view =
+ general-view
+ | interconnection-view
+ | action-flow-view
+ | state-transition-view
+ | sequence-view
+
+view-frame-name-compartment = '«view»' QualifiedName (':' QualifiedName)?
+
+view-frame-info-contents = Expose? ElementFilterMember? AnnotatingElement*
+
+view-frame-info-compartment-tr =
+
+
+view-frame-info-compartment-bl =
+
+
+view-frame-info-compartment-br =
+
+
+general-relationship =| expose-relationship
+
+expose-relationship =
+ expose-r | toplevel-expose-r | recursive-expose-r
+
+expose-r =
+
+
+toplevel-expose-r =
+
+
+recursive-expose-r =
+
+
+// Note. The view frame info compartments are optional elements. The AnnotatingElement* enables adding any relevant supporting information related to a view, possibly using a configurable rendering.
+
+// Note. A model library in Section 9.2.18 defines standard graphical view definitions for SysML. These may be supplemented by further, customized view definitions specific to a model.
+
+// Clause 8.2.3.27 Metadata Graphical Notation
+
+annotation-node =| metadata-feature-annotation-node
+
+metadata-feature-annotation-node =
+
+
+metadata-feature-decl = Identification
+
+metadata-feature-name-value-list =
+ ( metadata-feature-name '=' expression-text )*
+
+metadata-feature-name = Identification
+
+expression-text = text-block
+
+metadata-def =
+
+
+metadata-def-name-compartment =
+ '«' BasicUsagePrefix? keyword* 'metadata' 'def' '»'
+ definition-name-with-alias
+
+// End of BNF
+
+
+
+// Consolidated partial productions:
+
+// action-flow-element =
+// action | action-flow-node | action-flow-relationship | action-ref | analysis | analysis-def | calc | calc-def
+// | use-case | use-case-def | verification | verification-def
+
+// annotation-node =
+// metadata-feature-annotation-node
+
+// compartment =
+// action-flow-compartment | actions-compartment | actors-compartment | allocations-compartment | analyses-compartment
+// | assert-constraints-compartment | assert-constraints-compartment | assume-constraints-compartment
+// | attributes-compartment | calcs-compartment | connections-compartment | constraints-compartment
+// | constraints-compartment | directed-features-compartment | ends-compartment | enums-compartment
+// | exhibit-states-compartment | exposes-compartment | features-compartment | filters-compartment | flows-compartment
+// | frames-compartment | general-compartment | include-actions-compartment | includes-compartment
+// | individuals-compartment | interconnection-compartment | interfaces-compartment | items-compartment
+// | objective-compartment | occurrences-compartment | package-compartment | parameters-compartment | parts-compartment
+// | perform-actions-compartment | ports-compartment | rendering-compartment | require-constraints-compartment
+// | requirements-compartment | result-compartment | satisfies-compartment | satisfy-requirements-compartment
+// | sequence-compartment | snapshots-compartment | stakeholders-compartment | state-actions-compartment
+// | state-transition-compartment | states-compartment | subject-compartment | successions-compartment
+// | timeslices-compartment | use-cases-compartment | variant-elementusages-compartment | variants-compartment
+// | verification-methods-compartment | verifications-compartment | verifies-compartment | viewpoints-compartment
+// | views-compartment
+
+// connection-relationship =
+// flow | flow-on-connection | interface-connection | message-connection | succession-flow
+
+// definition-node =
+// action-def | allocation-def | analysis-def | attribute-def | calc-def | concern-def | connection-def
+// | constraint-def | enumeration-def | event-occurrence-def | extended-def | flow-def | interface-def | item-def
+// | n-ary-def-connection-dot | occurrence-def | part-def | port-def | requirement-def | state-def | use-case-def
+// | verification-def | view-def | viewpoint-def
+
+// dependencies-and-annotations-element =
+// annotation-link | annotation-node | dependencies-element
+
+// dependencies-element =
+// binary-dependency | n-ary-dependency
+
+// general-node =
+// definition-node | namespace-node | type-node | usage-node
+
+// general-relationship =
+// allocate-relationship | assert-edge | assume-edge | connection-def-graphical | exhibit-edge | expose-relationship
+// | frame-edge | frame-relationship | import | include-use-case-relationship | n-ary-def-segment | owned-membership
+// | portion-relationship | recursive-import | require-edge | satisfy-edge | top-level-import | type-relationship
+// | unowned-membership | verify-relationship
+
+// general-view =
+// interconnection-view
+
+// interconnection-element =
+// attribute | concern | concern-stakeholder-link | connection | connection-def | connection-relationship | constraint
+// | constraint-ref | distinguished-parameter | distinguished-parameter-link | flow | flow-def | interface | item
+// | item-ref | part | part-ref | port-def | port-usage | requirement | requirement-ref | view | view-def | viewpoint
+// | viewpoint-def
+
+// interconnection-view =
+// dependencies-and-annotations-element | ellipsis-at-lower-left-corner | interconnection-element
+
+// namespace-node =
+// package-node | type-node
+
+// subject-actors-stakeholders-node =
+// analysis | analysis-def | requirement | use-case | use-case-def | verification | verification-def
+
+// usage-edge =
+// allocate-relationship | binding-connection | connection-graphical | exhibit-edge | flow | message | perform-edge
+// | st-succession | succession | succession-flow | transition
+
+// usage-node =
+// action | allocation | analysis | assert-constraint-node | assume-constraint-node | attribute | calc | connection
+// | enumeration | event-occurrence | exhibit-state-usage | extended-usage | flow-node | frame-concern-node | framed-view
+// | include-use-case-usage | interface | item | n-ary-connection-dot | occurrence | occurrence-ref | part
+// | perform-action-usage | port-usage | require-constraint-node | state | timeslice-or-snapshot-node | use-case
+// | verification | verify-requirement-node | view | viewpoint
+
diff --git a/Resources/kgbnf.g4 b/Resources/kgbnf.g4
new file mode 100644
index 000000000..7d1ff25a8
--- /dev/null
+++ b/Resources/kgbnf.g4
@@ -0,0 +1,65 @@
+// Grammar
+
+grammar kgbnf;
+
+specification : (NL)* rule_definition+ EOF ;
+
+rule_definition
+ : name=GRAPHICAL_NAME op=(ASSIGN | PARTIAL_ASSIGN) rule_body=alternatives NL+
+ ;
+
+alternatives
+ : alternative (PIPE alternative)*
+ ;
+
+alternative
+ : element*
+ ;
+
+element
+ : group
+ | terminal
+ | image
+ | edge_end
+ | non_terminal
+ ;
+
+group
+ : LPAREN alternatives RPAREN (suffix=suffix_op)?
+ ;
+
+terminal
+ : val=SINGLE_QUOTED_STRING (suffix=suffix_op)?
+ ;
+
+image
+ : IMAGE
+ ;
+
+edge_end
+ : AMPERSAND name=GRAPHICAL_NAME (suffix=suffix_op)?
+ ;
+
+non_terminal
+ : name=(GRAPHICAL_NAME | TEXTUAL_NAME) (suffix=suffix_op)?
+ ;
+
+suffix_op : '*' | '+' | '?' ;
+
+// Lexer
+PARTIAL_ASSIGN : '=|' | '|=' ;
+ASSIGN : '=' ;
+PIPE : '|' ;
+LPAREN : '(' ;
+RPAREN : ')' ;
+AMPERSAND : '&' ;
+IMAGE : '
]* '>' ;
+
+GRAPHICAL_NAME : [a-z]+ ('-' [a-z]+)* ;
+TEXTUAL_NAME : [a-zA-Z_] [a-zA-Z0-9_]* ;
+SINGLE_QUOTED_STRING : '\'' (~['\\] | '\\' .)* '\'' ;
+
+COMMENT : '//' ~[\r\n]* -> skip ;
+WS : [ \t]+ -> skip ;
+CONTINUATION : '\r'? '\n' [ \t]+ -> skip ;
+NL : '\r'? '\n' ;
diff --git a/SysML2.NET.CodeGenerator.Tests/Extensions/GraphicalGrammarErrataTestFixture.cs b/SysML2.NET.CodeGenerator.Tests/Extensions/GraphicalGrammarErrataTestFixture.cs
new file mode 100644
index 000000000..86012e08f
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Extensions/GraphicalGrammarErrataTestFixture.cs
@@ -0,0 +1,33 @@
+// ------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+// SPDX-License-Identifier: Apache-2.0
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.Tests.Extensions
+{
+ using System.IO;
+ using System.Linq;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.CodeGenerator.Extensions;
+ using SysML2.NET.CodeGenerator.Grammar;
+
+ [TestFixture]
+ public class GraphicalGrammarErrataTestFixture
+ {
+ [Test]
+ public void VerifyQueryUnappliedErrata()
+ {
+ GrammarLoader.LoadGraphicalNotationSpecification(Path.Combine(TestContext.CurrentContext.TestDirectory, "datamodel", "SysML-graphical-bnf.kgbnf"));
+
+ var unapplied = GraphicalGrammarErrata.QueryUnappliedErrata();
+
+ Assert.That(unapplied, Is.Empty, $"Errata matched nothing in the graphical BNF: {string.Join(", ", unapplied.Select(erratum => erratum.RuleName))}");
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator.Tests/Grammar/GraphicalNotationSpecificationVisitorTestFixture.cs b/SysML2.NET.CodeGenerator.Tests/Grammar/GraphicalNotationSpecificationVisitorTestFixture.cs
new file mode 100644
index 000000000..1fa47ab91
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Grammar/GraphicalNotationSpecificationVisitorTestFixture.cs
@@ -0,0 +1,40 @@
+// ------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+// SPDX-License-Identifier: Apache-2.0
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.Tests.Grammar
+{
+ using System.IO;
+
+ using Antlr4.Runtime;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.CodeGenerator.Grammar;
+ using SysML2.NET.CodeGenerator.Grammar.Model;
+
+ [TestFixture]
+ public class GraphicalNotationSpecificationVisitorTestFixture
+ {
+ [Test]
+ public void VerifyCanParseGrammar()
+ {
+ var filePath = Path.Combine(TestContext.CurrentContext.TestDirectory, "datamodel", "SysML-graphical-bnf.kgbnf");
+
+ var parser = new kgbnfParser(new CommonTokenStream(new kgbnfLexer(CharStreams.fromPath(filePath))));
+ var tree = parser.specification();
+ var specification = (GraphicalNotationSpecification)new GraphicalNotationSpecificationVisitor().Visit(tree);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(parser.NumberOfSyntaxErrors, Is.Zero);
+ Assert.That(specification.Rules, Is.Not.Empty);
+ }
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator/Extensions/GraphicalGrammarErrata.cs b/SysML2.NET.CodeGenerator/Extensions/GraphicalGrammarErrata.cs
new file mode 100644
index 000000000..0d407bdc2
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Extensions/GraphicalGrammarErrata.cs
@@ -0,0 +1,99 @@
+// ------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+// SPDX-License-Identifier: Apache-2.0
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.Extensions
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Corrects known defects in the graphical BNF (Resources/SysML-graphical-bnf.kgbnf), at generation time.
+ ///
+ ///
+ /// The grammar is OMG source and is never edited. An entry belongs here only when a reference names no production and exactly
+ /// one production is evidently meant; a reference with no evident target stays unresolved and is reported by
+ /// GraphicalNotationSpecification.QueryUnresolvedReferences.
+ ///
+ public static class GraphicalGrammarErrata
+ {
+ ///
+ /// The production-text corrections applied to the grammar before it is parsed.
+ ///
+ private static readonly GrammarProductionErratum[] ProductionEntries =
+ [
+ new("usage-cp",
+ "usage-cp = usageDeclaration ValuePart?",
+ "usage-cp = UsageDeclaration ValuePart?",
+ "SysML 8.2.3.6 writes 'usageDeclaration', which names no rule; every other reference in 8.2.3 writes the textual rule " +
+ "'UsageDeclaration' (SysML 8.2.2.6.2)."),
+ new("allocation-node",
+ "allocation-node =\n general-node\n | element-in-textual-compartment",
+ "allocation-node =\n general-node\n | element-inside-textual-compartment",
+ "SysML 8.2.3.15 references 'element-in-textual-compartment', which is never defined; the production is " +
+ "'element-inside-textual-compartment' (SysML 8.2.3.2)."),
+ new("exhibit-states-compartment-contents",
+ "exhibit-states-compartment-contents = exhibit-state-scompartment-element* '…'?\n\nexhibit-states-compartment-element-compartment = UsageDeclaration",
+ "exhibit-states-compartment-contents = exhibit-states-compartment-element* '…'?\n\nexhibit-states-compartment-element = UsageDeclaration",
+ "SysML 8.2.3.18 references 'exhibit-state-scompartment-element', which is never defined, and defines " +
+ "'exhibit-states-compartment-element-compartment', which is never referenced; every sibling compartment pairs " +
+ "'-compartment-contents' with '-compartment-element'."),
+ new("action-flow-view",
+ "(perform-action-swimlanes)?",
+ "(perform-actions-swimlanes)?",
+ "SysML 8.2.3.17 references 'perform-action-swimlanes', which is never defined; the production is 'perform-actions-swimlanes'.")
+ ];
+
+ ///
+ /// The production rule names whose corrections have matched during this generator run.
+ ///
+ private static readonly HashSet AppliedRuleNames = [];
+
+ ///
+ /// Applies every known production correction to the raw text of the graphical BNF.
+ ///
+ /// The grammar text as read from disk.
+ /// The corrected grammar text with \n line endings, or when it is blank.
+ ///
+ /// Line endings are normalised first because every Original is written with \n.
+ ///
+ public static string ApplyProductions(string kgbnfSource)
+ {
+ if (string.IsNullOrWhiteSpace(kgbnfSource))
+ {
+ return kgbnfSource;
+ }
+
+ var normalisedSource = kgbnfSource.Replace("\r\n", "\n").Replace('\r', '\n');
+
+ return ProductionEntries
+ .Where(erratum => normalisedSource.Contains(erratum.Original, StringComparison.Ordinal))
+ .Aggregate(normalisedSource, (corrected, erratum) =>
+ {
+ AppliedRuleNames.Add(erratum.RuleName);
+ return corrected.Replace(erratum.Original, erratum.Replacement, StringComparison.Ordinal);
+ });
+ }
+
+ ///
+ /// Returns the corrections that matched nothing during this generator run.
+ ///
+ /// The stale entries, which should be pruned.
+ ///
+ /// Only meaningful once the graphical BNF has been loaded.
+ ///
+ public static IReadOnlyList<(string RuleName, string Justification)> QueryUnappliedErrata()
+ =>
+ [
+ ..ProductionEntries
+ .Where(erratum => !AppliedRuleNames.Contains(erratum.RuleName))
+ .Select(erratum => (erratum.RuleName, erratum.Justification))
+ ];
+ }
+}
diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnf.interp b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnf.interp
new file mode 100644
index 000000000..06587f432
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnf.interp
@@ -0,0 +1,56 @@
+token literal names:
+null
+'*'
+'+'
+'?'
+null
+'='
+'|'
+'('
+')'
+'&'
+null
+null
+null
+null
+null
+null
+null
+null
+
+token symbolic names:
+null
+null
+null
+null
+PARTIAL_ASSIGN
+ASSIGN
+PIPE
+LPAREN
+RPAREN
+AMPERSAND
+IMAGE
+GRAPHICAL_NAME
+TEXTUAL_NAME
+SINGLE_QUOTED_STRING
+COMMENT
+WS
+CONTINUATION
+NL
+
+rule names:
+specification
+rule_definition
+alternatives
+alternative
+element
+group
+terminal
+image
+edge_end
+non_terminal
+suffix_op
+
+
+atn:
+[4, 1, 17, 88, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 1, 0, 5, 0, 24, 8, 0, 10, 0, 12, 0, 27, 9, 0, 1, 0, 4, 0, 30, 8, 0, 11, 0, 12, 0, 31, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 40, 8, 1, 11, 1, 12, 1, 41, 1, 2, 1, 2, 1, 2, 5, 2, 47, 8, 2, 10, 2, 12, 2, 50, 9, 2, 1, 3, 5, 3, 53, 8, 3, 10, 3, 12, 3, 56, 9, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 63, 8, 4, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 69, 8, 5, 1, 6, 1, 6, 3, 6, 73, 8, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 3, 8, 80, 8, 8, 1, 9, 1, 9, 3, 9, 84, 8, 9, 1, 10, 1, 10, 1, 10, 0, 0, 11, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 0, 3, 1, 0, 4, 5, 1, 0, 11, 12, 1, 0, 1, 3, 89, 0, 25, 1, 0, 0, 0, 2, 35, 1, 0, 0, 0, 4, 43, 1, 0, 0, 0, 6, 54, 1, 0, 0, 0, 8, 62, 1, 0, 0, 0, 10, 64, 1, 0, 0, 0, 12, 70, 1, 0, 0, 0, 14, 74, 1, 0, 0, 0, 16, 76, 1, 0, 0, 0, 18, 81, 1, 0, 0, 0, 20, 85, 1, 0, 0, 0, 22, 24, 5, 17, 0, 0, 23, 22, 1, 0, 0, 0, 24, 27, 1, 0, 0, 0, 25, 23, 1, 0, 0, 0, 25, 26, 1, 0, 0, 0, 26, 29, 1, 0, 0, 0, 27, 25, 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 33, 1, 0, 0, 0, 33, 34, 5, 0, 0, 1, 34, 1, 1, 0, 0, 0, 35, 36, 5, 11, 0, 0, 36, 37, 7, 0, 0, 0, 37, 39, 3, 4, 2, 0, 38, 40, 5, 17, 0, 0, 39, 38, 1, 0, 0, 0, 40, 41, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 41, 42, 1, 0, 0, 0, 42, 3, 1, 0, 0, 0, 43, 48, 3, 6, 3, 0, 44, 45, 5, 6, 0, 0, 45, 47, 3, 6, 3, 0, 46, 44, 1, 0, 0, 0, 47, 50, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 5, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 51, 53, 3, 8, 4, 0, 52, 51, 1, 0, 0, 0, 53, 56, 1, 0, 0, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 7, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 57, 63, 3, 10, 5, 0, 58, 63, 3, 12, 6, 0, 59, 63, 3, 14, 7, 0, 60, 63, 3, 16, 8, 0, 61, 63, 3, 18, 9, 0, 62, 57, 1, 0, 0, 0, 62, 58, 1, 0, 0, 0, 62, 59, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 61, 1, 0, 0, 0, 63, 9, 1, 0, 0, 0, 64, 65, 5, 7, 0, 0, 65, 66, 3, 4, 2, 0, 66, 68, 5, 8, 0, 0, 67, 69, 3, 20, 10, 0, 68, 67, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0, 69, 11, 1, 0, 0, 0, 70, 72, 5, 13, 0, 0, 71, 73, 3, 20, 10, 0, 72, 71, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 13, 1, 0, 0, 0, 74, 75, 5, 10, 0, 0, 75, 15, 1, 0, 0, 0, 76, 77, 5, 9, 0, 0, 77, 79, 5, 11, 0, 0, 78, 80, 3, 20, 10, 0, 79, 78, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 17, 1, 0, 0, 0, 81, 83, 7, 1, 0, 0, 82, 84, 3, 20, 10, 0, 83, 82, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 19, 1, 0, 0, 0, 85, 86, 7, 2, 0, 0, 86, 21, 1, 0, 0, 0, 10, 25, 31, 41, 48, 54, 62, 68, 72, 79, 83]
\ No newline at end of file
diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnf.tokens b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnf.tokens
new file mode 100644
index 000000000..e8634e780
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnf.tokens
@@ -0,0 +1,25 @@
+T__0=1
+T__1=2
+T__2=3
+PARTIAL_ASSIGN=4
+ASSIGN=5
+PIPE=6
+LPAREN=7
+RPAREN=8
+AMPERSAND=9
+IMAGE=10
+GRAPHICAL_NAME=11
+TEXTUAL_NAME=12
+SINGLE_QUOTED_STRING=13
+COMMENT=14
+WS=15
+CONTINUATION=16
+NL=17
+'*'=1
+'+'=2
+'?'=3
+'='=5
+'|'=6
+'('=7
+')'=8
+'&'=9
diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfBaseListener.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfBaseListener.cs
new file mode 100644
index 000000000..cdb483553
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfBaseListener.cs
@@ -0,0 +1,185 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// ANTLR Version: 4.13.2
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+// Generated from Resources/kgbnf.g4 by ANTLR 4.13.2
+
+// Unreachable code detected
+#pragma warning disable 0162
+// The variable '...' is assigned but its value is never used
+#pragma warning disable 0219
+// Missing XML comment for publicly visible type or member '...'
+#pragma warning disable 1591
+// Ambiguous reference in cref attribute
+#pragma warning disable 419
+
+namespace SysML2.NET.CodeGenerator.Grammar {
+
+using Antlr4.Runtime.Misc;
+using IErrorNode = Antlr4.Runtime.Tree.IErrorNode;
+using ITerminalNode = Antlr4.Runtime.Tree.ITerminalNode;
+using IToken = Antlr4.Runtime.IToken;
+using ParserRuleContext = Antlr4.Runtime.ParserRuleContext;
+
+///
+/// This class provides an empty implementation of ,
+/// which can be extended to create a listener which only needs to handle a subset
+/// of the available methods.
+///
+[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")]
+[System.Diagnostics.DebuggerNonUserCode]
+[System.CLSCompliant(false)]
+public partial class kgbnfBaseListener : IkgbnfListener {
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterSpecification([NotNull] kgbnfParser.SpecificationContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitSpecification([NotNull] kgbnfParser.SpecificationContext context) { }
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterRule_definition([NotNull] kgbnfParser.Rule_definitionContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitRule_definition([NotNull] kgbnfParser.Rule_definitionContext context) { }
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterAlternatives([NotNull] kgbnfParser.AlternativesContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitAlternatives([NotNull] kgbnfParser.AlternativesContext context) { }
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterAlternative([NotNull] kgbnfParser.AlternativeContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitAlternative([NotNull] kgbnfParser.AlternativeContext context) { }
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterElement([NotNull] kgbnfParser.ElementContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitElement([NotNull] kgbnfParser.ElementContext context) { }
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterGroup([NotNull] kgbnfParser.GroupContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitGroup([NotNull] kgbnfParser.GroupContext context) { }
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterTerminal([NotNull] kgbnfParser.TerminalContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitTerminal([NotNull] kgbnfParser.TerminalContext context) { }
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterImage([NotNull] kgbnfParser.ImageContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitImage([NotNull] kgbnfParser.ImageContext context) { }
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterEdge_end([NotNull] kgbnfParser.Edge_endContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitEdge_end([NotNull] kgbnfParser.Edge_endContext context) { }
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterNon_terminal([NotNull] kgbnfParser.Non_terminalContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitNon_terminal([NotNull] kgbnfParser.Non_terminalContext context) { }
+ ///
+ /// Enter a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void EnterSuffix_op([NotNull] kgbnfParser.Suffix_opContext context) { }
+ ///
+ /// Exit a parse tree produced by .
+ /// The default implementation does nothing.
+ ///
+ /// The parse tree.
+ public virtual void ExitSuffix_op([NotNull] kgbnfParser.Suffix_opContext context) { }
+
+ ///
+ /// The default implementation does nothing.
+ public virtual void EnterEveryRule([NotNull] ParserRuleContext context) { }
+ ///
+ /// The default implementation does nothing.
+ public virtual void ExitEveryRule([NotNull] ParserRuleContext context) { }
+ ///
+ /// The default implementation does nothing.
+ public virtual void VisitTerminal([NotNull] ITerminalNode node) { }
+ ///
+ /// The default implementation does nothing.
+ public virtual void VisitErrorNode([NotNull] IErrorNode node) { }
+}
+} // namespace SysML2.NET.CodeGenerator.Grammar
diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfBaseVisitor.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfBaseVisitor.cs
new file mode 100644
index 000000000..f36b2729b
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfBaseVisitor.cs
@@ -0,0 +1,149 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// ANTLR Version: 4.13.2
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+// Generated from Resources/kgbnf.g4 by ANTLR 4.13.2
+
+// Unreachable code detected
+#pragma warning disable 0162
+// The variable '...' is assigned but its value is never used
+#pragma warning disable 0219
+// Missing XML comment for publicly visible type or member '...'
+#pragma warning disable 1591
+// Ambiguous reference in cref attribute
+#pragma warning disable 419
+
+namespace SysML2.NET.CodeGenerator.Grammar {
+using Antlr4.Runtime.Misc;
+using Antlr4.Runtime.Tree;
+using IToken = Antlr4.Runtime.IToken;
+using ParserRuleContext = Antlr4.Runtime.ParserRuleContext;
+
+///
+/// This class provides an empty implementation of ,
+/// which can be extended to create a visitor which only needs to handle a subset
+/// of the available methods.
+///
+/// The return type of the visit operation.
+[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")]
+[System.Diagnostics.DebuggerNonUserCode]
+[System.CLSCompliant(false)]
+public partial class kgbnfBaseVisitor : AbstractParseTreeVisitor, IkgbnfVisitor {
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitSpecification([NotNull] kgbnfParser.SpecificationContext context) { return VisitChildren(context); }
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitRule_definition([NotNull] kgbnfParser.Rule_definitionContext context) { return VisitChildren(context); }
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitAlternatives([NotNull] kgbnfParser.AlternativesContext context) { return VisitChildren(context); }
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitAlternative([NotNull] kgbnfParser.AlternativeContext context) { return VisitChildren(context); }
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitElement([NotNull] kgbnfParser.ElementContext context) { return VisitChildren(context); }
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitGroup([NotNull] kgbnfParser.GroupContext context) { return VisitChildren(context); }
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitTerminal([NotNull] kgbnfParser.TerminalContext context) { return VisitChildren(context); }
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitImage([NotNull] kgbnfParser.ImageContext context) { return VisitChildren(context); }
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitEdge_end([NotNull] kgbnfParser.Edge_endContext context) { return VisitChildren(context); }
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitNon_terminal([NotNull] kgbnfParser.Non_terminalContext context) { return VisitChildren(context); }
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The default implementation returns the result of calling
+ /// on .
+ ///
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ public virtual Result VisitSuffix_op([NotNull] kgbnfParser.Suffix_opContext context) { return VisitChildren(context); }
+}
+} // namespace SysML2.NET.CodeGenerator.Grammar
diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfLexer.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfLexer.cs
new file mode 100644
index 000000000..678adde31
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfLexer.cs
@@ -0,0 +1,153 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// ANTLR Version: 4.13.2
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+// Generated from Resources/kgbnf.g4 by ANTLR 4.13.2
+
+// Unreachable code detected
+#pragma warning disable 0162
+// The variable '...' is assigned but its value is never used
+#pragma warning disable 0219
+// Missing XML comment for publicly visible type or member '...'
+#pragma warning disable 1591
+// Ambiguous reference in cref attribute
+#pragma warning disable 419
+
+namespace SysML2.NET.CodeGenerator.Grammar {
+using System;
+using System.IO;
+using System.Text;
+using Antlr4.Runtime;
+using Antlr4.Runtime.Atn;
+using Antlr4.Runtime.Misc;
+using DFA = Antlr4.Runtime.Dfa.DFA;
+
+[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")]
+[System.CLSCompliant(false)]
+public partial class kgbnfLexer : Lexer {
+ protected static DFA[] decisionToDFA;
+ protected static PredictionContextCache sharedContextCache = new PredictionContextCache();
+ public const int
+ T__0=1, T__1=2, T__2=3, PARTIAL_ASSIGN=4, ASSIGN=5, PIPE=6, LPAREN=7,
+ RPAREN=8, AMPERSAND=9, IMAGE=10, GRAPHICAL_NAME=11, TEXTUAL_NAME=12, SINGLE_QUOTED_STRING=13,
+ COMMENT=14, WS=15, CONTINUATION=16, NL=17;
+ public static string[] channelNames = {
+ "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
+ };
+
+ public static string[] modeNames = {
+ "DEFAULT_MODE"
+ };
+
+ public static readonly string[] ruleNames = {
+ "T__0", "T__1", "T__2", "PARTIAL_ASSIGN", "ASSIGN", "PIPE", "LPAREN",
+ "RPAREN", "AMPERSAND", "IMAGE", "GRAPHICAL_NAME", "TEXTUAL_NAME", "SINGLE_QUOTED_STRING",
+ "COMMENT", "WS", "CONTINUATION", "NL"
+ };
+
+
+ public kgbnfLexer(ICharStream input)
+ : this(input, Console.Out, Console.Error) { }
+
+ public kgbnfLexer(ICharStream input, TextWriter output, TextWriter errorOutput)
+ : base(input, output, errorOutput)
+ {
+ Interpreter = new LexerATNSimulator(this, _ATN, decisionToDFA, sharedContextCache);
+ }
+
+ private static readonly string[] _LiteralNames = {
+ null, "'*'", "'+'", "'?'", null, "'='", "'|'", "'('", "')'", "'&'"
+ };
+ private static readonly string[] _SymbolicNames = {
+ null, null, null, null, "PARTIAL_ASSIGN", "ASSIGN", "PIPE", "LPAREN",
+ "RPAREN", "AMPERSAND", "IMAGE", "GRAPHICAL_NAME", "TEXTUAL_NAME", "SINGLE_QUOTED_STRING",
+ "COMMENT", "WS", "CONTINUATION", "NL"
+ };
+ public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames);
+
+ [NotNull]
+ public override IVocabulary Vocabulary
+ {
+ get
+ {
+ return DefaultVocabulary;
+ }
+ }
+
+ public override string GrammarFileName { get { return "kgbnf.g4"; } }
+
+ public override string[] RuleNames { get { return ruleNames; } }
+
+ public override string[] ChannelNames { get { return channelNames; } }
+
+ public override string[] ModeNames { get { return modeNames; } }
+
+ public override int[] SerializedAtn { get { return _serializedATN; } }
+
+ static kgbnfLexer() {
+ decisionToDFA = new DFA[_ATN.NumberOfDecisions];
+ for (int i = 0; i < _ATN.NumberOfDecisions; i++) {
+ decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i);
+ }
+ }
+ private static int[] _serializedATN = {
+ 4,0,17,138,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,
+ 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,
+ 7,14,2,15,7,15,2,16,7,16,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,3,1,3,3,3,46,
+ 8,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,5,
+ 9,64,8,9,10,9,12,9,67,9,9,1,9,1,9,1,10,4,10,72,8,10,11,10,12,10,73,1,10,
+ 1,10,4,10,78,8,10,11,10,12,10,79,5,10,82,8,10,10,10,12,10,85,9,10,1,11,
+ 1,11,5,11,89,8,11,10,11,12,11,92,9,11,1,12,1,12,1,12,1,12,5,12,98,8,12,
+ 10,12,12,12,101,9,12,1,12,1,12,1,13,1,13,1,13,1,13,5,13,109,8,13,10,13,
+ 12,13,112,9,13,1,13,1,13,1,14,4,14,117,8,14,11,14,12,14,118,1,14,1,14,
+ 1,15,3,15,124,8,15,1,15,1,15,4,15,128,8,15,11,15,12,15,129,1,15,1,15,1,
+ 16,3,16,135,8,16,1,16,1,16,0,0,17,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,
+ 9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,1,0,7,1,0,62,62,1,0,
+ 97,122,3,0,65,90,95,95,97,122,4,0,48,57,65,90,95,95,97,122,2,0,39,39,92,
+ 92,2,0,10,10,13,13,2,0,9,9,32,32,150,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,
+ 0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,
+ 1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,
+ 0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,1,35,1,0,0,0,3,37,1,0,0,0,5,39,
+ 1,0,0,0,7,45,1,0,0,0,9,47,1,0,0,0,11,49,1,0,0,0,13,51,1,0,0,0,15,53,1,
+ 0,0,0,17,55,1,0,0,0,19,57,1,0,0,0,21,71,1,0,0,0,23,86,1,0,0,0,25,93,1,
+ 0,0,0,27,104,1,0,0,0,29,116,1,0,0,0,31,123,1,0,0,0,33,134,1,0,0,0,35,36,
+ 5,42,0,0,36,2,1,0,0,0,37,38,5,43,0,0,38,4,1,0,0,0,39,40,5,63,0,0,40,6,
+ 1,0,0,0,41,42,5,61,0,0,42,46,5,124,0,0,43,44,5,124,0,0,44,46,5,61,0,0,
+ 45,41,1,0,0,0,45,43,1,0,0,0,46,8,1,0,0,0,47,48,5,61,0,0,48,10,1,0,0,0,
+ 49,50,5,124,0,0,50,12,1,0,0,0,51,52,5,40,0,0,52,14,1,0,0,0,53,54,5,41,
+ 0,0,54,16,1,0,0,0,55,56,5,38,0,0,56,18,1,0,0,0,57,58,5,60,0,0,58,59,5,
+ 105,0,0,59,60,5,109,0,0,60,61,5,103,0,0,61,65,1,0,0,0,62,64,8,0,0,0,63,
+ 62,1,0,0,0,64,67,1,0,0,0,65,63,1,0,0,0,65,66,1,0,0,0,66,68,1,0,0,0,67,
+ 65,1,0,0,0,68,69,5,62,0,0,69,20,1,0,0,0,70,72,7,1,0,0,71,70,1,0,0,0,72,
+ 73,1,0,0,0,73,71,1,0,0,0,73,74,1,0,0,0,74,83,1,0,0,0,75,77,5,45,0,0,76,
+ 78,7,1,0,0,77,76,1,0,0,0,78,79,1,0,0,0,79,77,1,0,0,0,79,80,1,0,0,0,80,
+ 82,1,0,0,0,81,75,1,0,0,0,82,85,1,0,0,0,83,81,1,0,0,0,83,84,1,0,0,0,84,
+ 22,1,0,0,0,85,83,1,0,0,0,86,90,7,2,0,0,87,89,7,3,0,0,88,87,1,0,0,0,89,
+ 92,1,0,0,0,90,88,1,0,0,0,90,91,1,0,0,0,91,24,1,0,0,0,92,90,1,0,0,0,93,
+ 99,5,39,0,0,94,98,8,4,0,0,95,96,5,92,0,0,96,98,9,0,0,0,97,94,1,0,0,0,97,
+ 95,1,0,0,0,98,101,1,0,0,0,99,97,1,0,0,0,99,100,1,0,0,0,100,102,1,0,0,0,
+ 101,99,1,0,0,0,102,103,5,39,0,0,103,26,1,0,0,0,104,105,5,47,0,0,105,106,
+ 5,47,0,0,106,110,1,0,0,0,107,109,8,5,0,0,108,107,1,0,0,0,109,112,1,0,0,
+ 0,110,108,1,0,0,0,110,111,1,0,0,0,111,113,1,0,0,0,112,110,1,0,0,0,113,
+ 114,6,13,0,0,114,28,1,0,0,0,115,117,7,6,0,0,116,115,1,0,0,0,117,118,1,
+ 0,0,0,118,116,1,0,0,0,118,119,1,0,0,0,119,120,1,0,0,0,120,121,6,14,0,0,
+ 121,30,1,0,0,0,122,124,5,13,0,0,123,122,1,0,0,0,123,124,1,0,0,0,124,125,
+ 1,0,0,0,125,127,5,10,0,0,126,128,7,6,0,0,127,126,1,0,0,0,128,129,1,0,0,
+ 0,129,127,1,0,0,0,129,130,1,0,0,0,130,131,1,0,0,0,131,132,6,15,0,0,132,
+ 32,1,0,0,0,133,135,5,13,0,0,134,133,1,0,0,0,134,135,1,0,0,0,135,136,1,
+ 0,0,0,136,137,5,10,0,0,137,34,1,0,0,0,14,0,45,65,73,79,83,90,97,99,110,
+ 118,123,129,134,1,6,0,0
+ };
+
+ public static readonly ATN _ATN =
+ new ATNDeserializer().Deserialize(_serializedATN);
+
+
+}
+} // namespace SysML2.NET.CodeGenerator.Grammar
diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfLexer.interp b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfLexer.interp
new file mode 100644
index 000000000..1da0be937
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfLexer.interp
@@ -0,0 +1,68 @@
+token literal names:
+null
+'*'
+'+'
+'?'
+null
+'='
+'|'
+'('
+')'
+'&'
+null
+null
+null
+null
+null
+null
+null
+null
+
+token symbolic names:
+null
+null
+null
+null
+PARTIAL_ASSIGN
+ASSIGN
+PIPE
+LPAREN
+RPAREN
+AMPERSAND
+IMAGE
+GRAPHICAL_NAME
+TEXTUAL_NAME
+SINGLE_QUOTED_STRING
+COMMENT
+WS
+CONTINUATION
+NL
+
+rule names:
+T__0
+T__1
+T__2
+PARTIAL_ASSIGN
+ASSIGN
+PIPE
+LPAREN
+RPAREN
+AMPERSAND
+IMAGE
+GRAPHICAL_NAME
+TEXTUAL_NAME
+SINGLE_QUOTED_STRING
+COMMENT
+WS
+CONTINUATION
+NL
+
+channel names:
+DEFAULT_TOKEN_CHANNEL
+HIDDEN
+
+mode names:
+DEFAULT_MODE
+
+atn:
+[4, 0, 17, 138, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 46, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 5, 9, 64, 8, 9, 10, 9, 12, 9, 67, 9, 9, 1, 9, 1, 9, 1, 10, 4, 10, 72, 8, 10, 11, 10, 12, 10, 73, 1, 10, 1, 10, 4, 10, 78, 8, 10, 11, 10, 12, 10, 79, 5, 10, 82, 8, 10, 10, 10, 12, 10, 85, 9, 10, 1, 11, 1, 11, 5, 11, 89, 8, 11, 10, 11, 12, 11, 92, 9, 11, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 98, 8, 12, 10, 12, 12, 12, 101, 9, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 5, 13, 109, 8, 13, 10, 13, 12, 13, 112, 9, 13, 1, 13, 1, 13, 1, 14, 4, 14, 117, 8, 14, 11, 14, 12, 14, 118, 1, 14, 1, 14, 1, 15, 3, 15, 124, 8, 15, 1, 15, 1, 15, 4, 15, 128, 8, 15, 11, 15, 12, 15, 129, 1, 15, 1, 15, 1, 16, 3, 16, 135, 8, 16, 1, 16, 1, 16, 0, 0, 17, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 1, 0, 7, 1, 0, 62, 62, 1, 0, 97, 122, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 39, 39, 92, 92, 2, 0, 10, 10, 13, 13, 2, 0, 9, 9, 32, 32, 150, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 1, 35, 1, 0, 0, 0, 3, 37, 1, 0, 0, 0, 5, 39, 1, 0, 0, 0, 7, 45, 1, 0, 0, 0, 9, 47, 1, 0, 0, 0, 11, 49, 1, 0, 0, 0, 13, 51, 1, 0, 0, 0, 15, 53, 1, 0, 0, 0, 17, 55, 1, 0, 0, 0, 19, 57, 1, 0, 0, 0, 21, 71, 1, 0, 0, 0, 23, 86, 1, 0, 0, 0, 25, 93, 1, 0, 0, 0, 27, 104, 1, 0, 0, 0, 29, 116, 1, 0, 0, 0, 31, 123, 1, 0, 0, 0, 33, 134, 1, 0, 0, 0, 35, 36, 5, 42, 0, 0, 36, 2, 1, 0, 0, 0, 37, 38, 5, 43, 0, 0, 38, 4, 1, 0, 0, 0, 39, 40, 5, 63, 0, 0, 40, 6, 1, 0, 0, 0, 41, 42, 5, 61, 0, 0, 42, 46, 5, 124, 0, 0, 43, 44, 5, 124, 0, 0, 44, 46, 5, 61, 0, 0, 45, 41, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 46, 8, 1, 0, 0, 0, 47, 48, 5, 61, 0, 0, 48, 10, 1, 0, 0, 0, 49, 50, 5, 124, 0, 0, 50, 12, 1, 0, 0, 0, 51, 52, 5, 40, 0, 0, 52, 14, 1, 0, 0, 0, 53, 54, 5, 41, 0, 0, 54, 16, 1, 0, 0, 0, 55, 56, 5, 38, 0, 0, 56, 18, 1, 0, 0, 0, 57, 58, 5, 60, 0, 0, 58, 59, 5, 105, 0, 0, 59, 60, 5, 109, 0, 0, 60, 61, 5, 103, 0, 0, 61, 65, 1, 0, 0, 0, 62, 64, 8, 0, 0, 0, 63, 62, 1, 0, 0, 0, 64, 67, 1, 0, 0, 0, 65, 63, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 68, 1, 0, 0, 0, 67, 65, 1, 0, 0, 0, 68, 69, 5, 62, 0, 0, 69, 20, 1, 0, 0, 0, 70, 72, 7, 1, 0, 0, 71, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 71, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 83, 1, 0, 0, 0, 75, 77, 5, 45, 0, 0, 76, 78, 7, 1, 0, 0, 77, 76, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 77, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 82, 1, 0, 0, 0, 81, 75, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 22, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 86, 90, 7, 2, 0, 0, 87, 89, 7, 3, 0, 0, 88, 87, 1, 0, 0, 0, 89, 92, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 24, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 93, 99, 5, 39, 0, 0, 94, 98, 8, 4, 0, 0, 95, 96, 5, 92, 0, 0, 96, 98, 9, 0, 0, 0, 97, 94, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 98, 101, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100, 102, 1, 0, 0, 0, 101, 99, 1, 0, 0, 0, 102, 103, 5, 39, 0, 0, 103, 26, 1, 0, 0, 0, 104, 105, 5, 47, 0, 0, 105, 106, 5, 47, 0, 0, 106, 110, 1, 0, 0, 0, 107, 109, 8, 5, 0, 0, 108, 107, 1, 0, 0, 0, 109, 112, 1, 0, 0, 0, 110, 108, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 113, 1, 0, 0, 0, 112, 110, 1, 0, 0, 0, 113, 114, 6, 13, 0, 0, 114, 28, 1, 0, 0, 0, 115, 117, 7, 6, 0, 0, 116, 115, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 118, 119, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 121, 6, 14, 0, 0, 121, 30, 1, 0, 0, 0, 122, 124, 5, 13, 0, 0, 123, 122, 1, 0, 0, 0, 123, 124, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 127, 5, 10, 0, 0, 126, 128, 7, 6, 0, 0, 127, 126, 1, 0, 0, 0, 128, 129, 1, 0, 0, 0, 129, 127, 1, 0, 0, 0, 129, 130, 1, 0, 0, 0, 130, 131, 1, 0, 0, 0, 131, 132, 6, 15, 0, 0, 132, 32, 1, 0, 0, 0, 133, 135, 5, 13, 0, 0, 134, 133, 1, 0, 0, 0, 134, 135, 1, 0, 0, 0, 135, 136, 1, 0, 0, 0, 136, 137, 5, 10, 0, 0, 137, 34, 1, 0, 0, 0, 14, 0, 45, 65, 73, 79, 83, 90, 97, 99, 110, 118, 123, 129, 134, 1, 6, 0, 0]
\ No newline at end of file
diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfLexer.tokens b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfLexer.tokens
new file mode 100644
index 000000000..e8634e780
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfLexer.tokens
@@ -0,0 +1,25 @@
+T__0=1
+T__1=2
+T__2=3
+PARTIAL_ASSIGN=4
+ASSIGN=5
+PIPE=6
+LPAREN=7
+RPAREN=8
+AMPERSAND=9
+IMAGE=10
+GRAPHICAL_NAME=11
+TEXTUAL_NAME=12
+SINGLE_QUOTED_STRING=13
+COMMENT=14
+WS=15
+CONTINUATION=16
+NL=17
+'*'=1
+'+'=2
+'?'=3
+'='=5
+'|'=6
+'('=7
+')'=8
+'&'=9
diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfListener.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfListener.cs
new file mode 100644
index 000000000..ac4ee4877
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfListener.cs
@@ -0,0 +1,145 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// ANTLR Version: 4.13.2
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+// Generated from Resources/kgbnf.g4 by ANTLR 4.13.2
+
+// Unreachable code detected
+#pragma warning disable 0162
+// The variable '...' is assigned but its value is never used
+#pragma warning disable 0219
+// Missing XML comment for publicly visible type or member '...'
+#pragma warning disable 1591
+// Ambiguous reference in cref attribute
+#pragma warning disable 419
+
+namespace SysML2.NET.CodeGenerator.Grammar {
+using Antlr4.Runtime.Misc;
+using IParseTreeListener = Antlr4.Runtime.Tree.IParseTreeListener;
+using IToken = Antlr4.Runtime.IToken;
+
+///
+/// This interface defines a complete listener for a parse tree produced by
+/// .
+///
+[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")]
+[System.CLSCompliant(false)]
+public interface IkgbnfListener : IParseTreeListener {
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterSpecification([NotNull] kgbnfParser.SpecificationContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitSpecification([NotNull] kgbnfParser.SpecificationContext context);
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterRule_definition([NotNull] kgbnfParser.Rule_definitionContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitRule_definition([NotNull] kgbnfParser.Rule_definitionContext context);
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterAlternatives([NotNull] kgbnfParser.AlternativesContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitAlternatives([NotNull] kgbnfParser.AlternativesContext context);
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterAlternative([NotNull] kgbnfParser.AlternativeContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitAlternative([NotNull] kgbnfParser.AlternativeContext context);
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterElement([NotNull] kgbnfParser.ElementContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitElement([NotNull] kgbnfParser.ElementContext context);
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterGroup([NotNull] kgbnfParser.GroupContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitGroup([NotNull] kgbnfParser.GroupContext context);
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterTerminal([NotNull] kgbnfParser.TerminalContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitTerminal([NotNull] kgbnfParser.TerminalContext context);
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterImage([NotNull] kgbnfParser.ImageContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitImage([NotNull] kgbnfParser.ImageContext context);
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterEdge_end([NotNull] kgbnfParser.Edge_endContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitEdge_end([NotNull] kgbnfParser.Edge_endContext context);
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterNon_terminal([NotNull] kgbnfParser.Non_terminalContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitNon_terminal([NotNull] kgbnfParser.Non_terminalContext context);
+ ///
+ /// Enter a parse tree produced by .
+ ///
+ /// The parse tree.
+ void EnterSuffix_op([NotNull] kgbnfParser.Suffix_opContext context);
+ ///
+ /// Exit a parse tree produced by .
+ ///
+ /// The parse tree.
+ void ExitSuffix_op([NotNull] kgbnfParser.Suffix_opContext context);
+}
+} // namespace SysML2.NET.CodeGenerator.Grammar
diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfParser.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfParser.cs
new file mode 100644
index 000000000..a2b56f9e5
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfParser.cs
@@ -0,0 +1,906 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// ANTLR Version: 4.13.2
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+// Generated from Resources/kgbnf.g4 by ANTLR 4.13.2
+
+// Unreachable code detected
+#pragma warning disable 0162
+// The variable '...' is assigned but its value is never used
+#pragma warning disable 0219
+// Missing XML comment for publicly visible type or member '...'
+#pragma warning disable 1591
+// Ambiguous reference in cref attribute
+#pragma warning disable 419
+
+namespace SysML2.NET.CodeGenerator.Grammar {
+using System;
+using System.IO;
+using System.Text;
+using System.Diagnostics;
+using System.Collections.Generic;
+using Antlr4.Runtime;
+using Antlr4.Runtime.Atn;
+using Antlr4.Runtime.Misc;
+using Antlr4.Runtime.Tree;
+using DFA = Antlr4.Runtime.Dfa.DFA;
+
+[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")]
+[System.CLSCompliant(false)]
+public partial class kgbnfParser : Parser {
+ protected static DFA[] decisionToDFA;
+ protected static PredictionContextCache sharedContextCache = new PredictionContextCache();
+ public const int
+ T__0=1, T__1=2, T__2=3, PARTIAL_ASSIGN=4, ASSIGN=5, PIPE=6, LPAREN=7,
+ RPAREN=8, AMPERSAND=9, IMAGE=10, GRAPHICAL_NAME=11, TEXTUAL_NAME=12, SINGLE_QUOTED_STRING=13,
+ COMMENT=14, WS=15, CONTINUATION=16, NL=17;
+ public const int
+ RULE_specification = 0, RULE_rule_definition = 1, RULE_alternatives = 2,
+ RULE_alternative = 3, RULE_element = 4, RULE_group = 5, RULE_terminal = 6,
+ RULE_image = 7, RULE_edge_end = 8, RULE_non_terminal = 9, RULE_suffix_op = 10;
+ public static readonly string[] ruleNames = {
+ "specification", "rule_definition", "alternatives", "alternative", "element",
+ "group", "terminal", "image", "edge_end", "non_terminal", "suffix_op"
+ };
+
+ private static readonly string[] _LiteralNames = {
+ null, "'*'", "'+'", "'?'", null, "'='", "'|'", "'('", "')'", "'&'"
+ };
+ private static readonly string[] _SymbolicNames = {
+ null, null, null, null, "PARTIAL_ASSIGN", "ASSIGN", "PIPE", "LPAREN",
+ "RPAREN", "AMPERSAND", "IMAGE", "GRAPHICAL_NAME", "TEXTUAL_NAME", "SINGLE_QUOTED_STRING",
+ "COMMENT", "WS", "CONTINUATION", "NL"
+ };
+ public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames);
+
+ [NotNull]
+ public override IVocabulary Vocabulary
+ {
+ get
+ {
+ return DefaultVocabulary;
+ }
+ }
+
+ public override string GrammarFileName { get { return "kgbnf.g4"; } }
+
+ public override string[] RuleNames { get { return ruleNames; } }
+
+ public override int[] SerializedAtn { get { return _serializedATN; } }
+
+ static kgbnfParser() {
+ decisionToDFA = new DFA[_ATN.NumberOfDecisions];
+ for (int i = 0; i < _ATN.NumberOfDecisions; i++) {
+ decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i);
+ }
+ }
+
+ public kgbnfParser(ITokenStream input) : this(input, Console.Out, Console.Error) { }
+
+ public kgbnfParser(ITokenStream input, TextWriter output, TextWriter errorOutput)
+ : base(input, output, errorOutput)
+ {
+ Interpreter = new ParserATNSimulator(this, _ATN, decisionToDFA, sharedContextCache);
+ }
+
+ public partial class SpecificationContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Eof() { return GetToken(kgbnfParser.Eof, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(kgbnfParser.NL); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) {
+ return GetToken(kgbnfParser.NL, i);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public Rule_definitionContext[] rule_definition() {
+ return GetRuleContexts();
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public Rule_definitionContext rule_definition(int i) {
+ return GetRuleContext(i);
+ }
+ public SpecificationContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_specification; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterSpecification(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitSpecification(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitSpecification(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public SpecificationContext specification() {
+ SpecificationContext _localctx = new SpecificationContext(Context, State);
+ EnterRule(_localctx, 0, RULE_specification);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 25;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ while (_la==NL) {
+ {
+ {
+ State = 22;
+ Match(NL);
+ }
+ }
+ State = 27;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ }
+ State = 29;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ do {
+ {
+ {
+ State = 28;
+ rule_definition();
+ }
+ }
+ State = 31;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ } while ( _la==GRAPHICAL_NAME );
+ State = 33;
+ Match(Eof);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class Rule_definitionContext : ParserRuleContext {
+ public IToken name;
+ public IToken op;
+ public AlternativesContext rule_body;
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode GRAPHICAL_NAME() { return GetToken(kgbnfParser.GRAPHICAL_NAME, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public AlternativesContext alternatives() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ASSIGN() { return GetToken(kgbnfParser.ASSIGN, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PARTIAL_ASSIGN() { return GetToken(kgbnfParser.PARTIAL_ASSIGN, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(kgbnfParser.NL); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) {
+ return GetToken(kgbnfParser.NL, i);
+ }
+ public Rule_definitionContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_rule_definition; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterRule_definition(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitRule_definition(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitRule_definition(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public Rule_definitionContext rule_definition() {
+ Rule_definitionContext _localctx = new Rule_definitionContext(Context, State);
+ EnterRule(_localctx, 2, RULE_rule_definition);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 35;
+ _localctx.name = Match(GRAPHICAL_NAME);
+ State = 36;
+ _localctx.op = TokenStream.LT(1);
+ _la = TokenStream.LA(1);
+ if ( !(_la==PARTIAL_ASSIGN || _la==ASSIGN) ) {
+ _localctx.op = ErrorHandler.RecoverInline(this);
+ }
+ else {
+ ErrorHandler.ReportMatch(this);
+ Consume();
+ }
+ State = 37;
+ _localctx.rule_body = alternatives();
+ State = 39;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ do {
+ {
+ {
+ State = 38;
+ Match(NL);
+ }
+ }
+ State = 41;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ } while ( _la==NL );
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class AlternativesContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public AlternativeContext[] alternative() {
+ return GetRuleContexts();
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public AlternativeContext alternative(int i) {
+ return GetRuleContext(i);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] PIPE() { return GetTokens(kgbnfParser.PIPE); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PIPE(int i) {
+ return GetToken(kgbnfParser.PIPE, i);
+ }
+ public AlternativesContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_alternatives; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterAlternatives(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitAlternatives(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitAlternatives(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public AlternativesContext alternatives() {
+ AlternativesContext _localctx = new AlternativesContext(Context, State);
+ EnterRule(_localctx, 4, RULE_alternatives);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 43;
+ alternative();
+ State = 48;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ while (_la==PIPE) {
+ {
+ {
+ State = 44;
+ Match(PIPE);
+ State = 45;
+ alternative();
+ }
+ }
+ State = 50;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class AlternativeContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public ElementContext[] element() {
+ return GetRuleContexts();
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ElementContext element(int i) {
+ return GetRuleContext(i);
+ }
+ public AlternativeContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_alternative; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterAlternative(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitAlternative(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitAlternative(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public AlternativeContext alternative() {
+ AlternativeContext _localctx = new AlternativeContext(Context, State);
+ EnterRule(_localctx, 6, RULE_alternative);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 54;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 16000L) != 0)) {
+ {
+ {
+ State = 51;
+ element();
+ }
+ }
+ State = 56;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class ElementContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public GroupContext group() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public TerminalContext terminal() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ImageContext image() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public Edge_endContext edge_end() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public Non_terminalContext non_terminal() {
+ return GetRuleContext(0);
+ }
+ public ElementContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_element; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterElement(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitElement(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitElement(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public ElementContext element() {
+ ElementContext _localctx = new ElementContext(Context, State);
+ EnterRule(_localctx, 8, RULE_element);
+ try {
+ State = 62;
+ ErrorHandler.Sync(this);
+ switch (TokenStream.LA(1)) {
+ case LPAREN:
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 57;
+ group();
+ }
+ break;
+ case SINGLE_QUOTED_STRING:
+ EnterOuterAlt(_localctx, 2);
+ {
+ State = 58;
+ terminal();
+ }
+ break;
+ case IMAGE:
+ EnterOuterAlt(_localctx, 3);
+ {
+ State = 59;
+ image();
+ }
+ break;
+ case AMPERSAND:
+ EnterOuterAlt(_localctx, 4);
+ {
+ State = 60;
+ edge_end();
+ }
+ break;
+ case GRAPHICAL_NAME:
+ case TEXTUAL_NAME:
+ EnterOuterAlt(_localctx, 5);
+ {
+ State = 61;
+ non_terminal();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class GroupContext : ParserRuleContext {
+ public Suffix_opContext suffix;
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPAREN() { return GetToken(kgbnfParser.LPAREN, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public AlternativesContext alternatives() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode RPAREN() { return GetToken(kgbnfParser.RPAREN, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public Suffix_opContext suffix_op() {
+ return GetRuleContext(0);
+ }
+ public GroupContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_group; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterGroup(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitGroup(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitGroup(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public GroupContext group() {
+ GroupContext _localctx = new GroupContext(Context, State);
+ EnterRule(_localctx, 10, RULE_group);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 64;
+ Match(LPAREN);
+ State = 65;
+ alternatives();
+ State = 66;
+ Match(RPAREN);
+ State = 68;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 14L) != 0)) {
+ {
+ State = 67;
+ _localctx.suffix = suffix_op();
+ }
+ }
+
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class TerminalContext : ParserRuleContext {
+ public IToken val;
+ public Suffix_opContext suffix;
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SINGLE_QUOTED_STRING() { return GetToken(kgbnfParser.SINGLE_QUOTED_STRING, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public Suffix_opContext suffix_op() {
+ return GetRuleContext(0);
+ }
+ public TerminalContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_terminal; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterTerminal(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitTerminal(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitTerminal(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public TerminalContext terminal() {
+ TerminalContext _localctx = new TerminalContext(Context, State);
+ EnterRule(_localctx, 12, RULE_terminal);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 70;
+ _localctx.val = Match(SINGLE_QUOTED_STRING);
+ State = 72;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 14L) != 0)) {
+ {
+ State = 71;
+ _localctx.suffix = suffix_op();
+ }
+ }
+
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class ImageContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode IMAGE() { return GetToken(kgbnfParser.IMAGE, 0); }
+ public ImageContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_image; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterImage(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitImage(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitImage(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public ImageContext image() {
+ ImageContext _localctx = new ImageContext(Context, State);
+ EnterRule(_localctx, 14, RULE_image);
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 74;
+ Match(IMAGE);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class Edge_endContext : ParserRuleContext {
+ public IToken name;
+ public Suffix_opContext suffix;
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode AMPERSAND() { return GetToken(kgbnfParser.AMPERSAND, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode GRAPHICAL_NAME() { return GetToken(kgbnfParser.GRAPHICAL_NAME, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public Suffix_opContext suffix_op() {
+ return GetRuleContext(0);
+ }
+ public Edge_endContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_edge_end; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterEdge_end(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitEdge_end(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitEdge_end(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public Edge_endContext edge_end() {
+ Edge_endContext _localctx = new Edge_endContext(Context, State);
+ EnterRule(_localctx, 16, RULE_edge_end);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 76;
+ Match(AMPERSAND);
+ State = 77;
+ _localctx.name = Match(GRAPHICAL_NAME);
+ State = 79;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 14L) != 0)) {
+ {
+ State = 78;
+ _localctx.suffix = suffix_op();
+ }
+ }
+
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class Non_terminalContext : ParserRuleContext {
+ public IToken name;
+ public Suffix_opContext suffix;
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode GRAPHICAL_NAME() { return GetToken(kgbnfParser.GRAPHICAL_NAME, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode TEXTUAL_NAME() { return GetToken(kgbnfParser.TEXTUAL_NAME, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public Suffix_opContext suffix_op() {
+ return GetRuleContext(0);
+ }
+ public Non_terminalContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_non_terminal; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterNon_terminal(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitNon_terminal(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitNon_terminal(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public Non_terminalContext non_terminal() {
+ Non_terminalContext _localctx = new Non_terminalContext(Context, State);
+ EnterRule(_localctx, 18, RULE_non_terminal);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 81;
+ _localctx.name = TokenStream.LT(1);
+ _la = TokenStream.LA(1);
+ if ( !(_la==GRAPHICAL_NAME || _la==TEXTUAL_NAME) ) {
+ _localctx.name = ErrorHandler.RecoverInline(this);
+ }
+ else {
+ ErrorHandler.ReportMatch(this);
+ Consume();
+ }
+ State = 83;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 14L) != 0)) {
+ {
+ State = 82;
+ _localctx.suffix = suffix_op();
+ }
+ }
+
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class Suffix_opContext : ParserRuleContext {
+ public Suffix_opContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_suffix_op; } }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void EnterRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.EnterSuffix_op(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override void ExitRule(IParseTreeListener listener) {
+ IkgbnfListener typedListener = listener as IkgbnfListener;
+ if (typedListener != null) typedListener.ExitSuffix_op(this);
+ }
+ [System.Diagnostics.DebuggerNonUserCode]
+ public override TResult Accept(IParseTreeVisitor visitor) {
+ IkgbnfVisitor typedVisitor = visitor as IkgbnfVisitor;
+ if (typedVisitor != null) return typedVisitor.VisitSuffix_op(this);
+ else return visitor.VisitChildren(this);
+ }
+ }
+
+ [RuleVersion(0)]
+ public Suffix_opContext suffix_op() {
+ Suffix_opContext _localctx = new Suffix_opContext(Context, State);
+ EnterRule(_localctx, 20, RULE_suffix_op);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 85;
+ _la = TokenStream.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 14L) != 0)) ) {
+ ErrorHandler.RecoverInline(this);
+ }
+ else {
+ ErrorHandler.ReportMatch(this);
+ Consume();
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ private static int[] _serializedATN = {
+ 4,1,17,88,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,
+ 7,7,2,8,7,8,2,9,7,9,2,10,7,10,1,0,5,0,24,8,0,10,0,12,0,27,9,0,1,0,4,0,
+ 30,8,0,11,0,12,0,31,1,0,1,0,1,1,1,1,1,1,1,1,4,1,40,8,1,11,1,12,1,41,1,
+ 2,1,2,1,2,5,2,47,8,2,10,2,12,2,50,9,2,1,3,5,3,53,8,3,10,3,12,3,56,9,3,
+ 1,4,1,4,1,4,1,4,1,4,3,4,63,8,4,1,5,1,5,1,5,1,5,3,5,69,8,5,1,6,1,6,3,6,
+ 73,8,6,1,7,1,7,1,8,1,8,1,8,3,8,80,8,8,1,9,1,9,3,9,84,8,9,1,10,1,10,1,10,
+ 0,0,11,0,2,4,6,8,10,12,14,16,18,20,0,3,1,0,4,5,1,0,11,12,1,0,1,3,89,0,
+ 25,1,0,0,0,2,35,1,0,0,0,4,43,1,0,0,0,6,54,1,0,0,0,8,62,1,0,0,0,10,64,1,
+ 0,0,0,12,70,1,0,0,0,14,74,1,0,0,0,16,76,1,0,0,0,18,81,1,0,0,0,20,85,1,
+ 0,0,0,22,24,5,17,0,0,23,22,1,0,0,0,24,27,1,0,0,0,25,23,1,0,0,0,25,26,1,
+ 0,0,0,26,29,1,0,0,0,27,25,1,0,0,0,28,30,3,2,1,0,29,28,1,0,0,0,30,31,1,
+ 0,0,0,31,29,1,0,0,0,31,32,1,0,0,0,32,33,1,0,0,0,33,34,5,0,0,1,34,1,1,0,
+ 0,0,35,36,5,11,0,0,36,37,7,0,0,0,37,39,3,4,2,0,38,40,5,17,0,0,39,38,1,
+ 0,0,0,40,41,1,0,0,0,41,39,1,0,0,0,41,42,1,0,0,0,42,3,1,0,0,0,43,48,3,6,
+ 3,0,44,45,5,6,0,0,45,47,3,6,3,0,46,44,1,0,0,0,47,50,1,0,0,0,48,46,1,0,
+ 0,0,48,49,1,0,0,0,49,5,1,0,0,0,50,48,1,0,0,0,51,53,3,8,4,0,52,51,1,0,0,
+ 0,53,56,1,0,0,0,54,52,1,0,0,0,54,55,1,0,0,0,55,7,1,0,0,0,56,54,1,0,0,0,
+ 57,63,3,10,5,0,58,63,3,12,6,0,59,63,3,14,7,0,60,63,3,16,8,0,61,63,3,18,
+ 9,0,62,57,1,0,0,0,62,58,1,0,0,0,62,59,1,0,0,0,62,60,1,0,0,0,62,61,1,0,
+ 0,0,63,9,1,0,0,0,64,65,5,7,0,0,65,66,3,4,2,0,66,68,5,8,0,0,67,69,3,20,
+ 10,0,68,67,1,0,0,0,68,69,1,0,0,0,69,11,1,0,0,0,70,72,5,13,0,0,71,73,3,
+ 20,10,0,72,71,1,0,0,0,72,73,1,0,0,0,73,13,1,0,0,0,74,75,5,10,0,0,75,15,
+ 1,0,0,0,76,77,5,9,0,0,77,79,5,11,0,0,78,80,3,20,10,0,79,78,1,0,0,0,79,
+ 80,1,0,0,0,80,17,1,0,0,0,81,83,7,1,0,0,82,84,3,20,10,0,83,82,1,0,0,0,83,
+ 84,1,0,0,0,84,19,1,0,0,0,85,86,7,2,0,0,86,21,1,0,0,0,10,25,31,41,48,54,
+ 62,68,72,79,83
+ };
+
+ public static readonly ATN _ATN =
+ new ATNDeserializer().Deserialize(_serializedATN);
+
+
+}
+} // namespace SysML2.NET.CodeGenerator.Grammar
diff --git a/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfVisitor.cs b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfVisitor.cs
new file mode 100644
index 000000000..9609d9251
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kgbnfVisitor.cs
@@ -0,0 +1,102 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// ANTLR Version: 4.13.2
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+// Generated from Resources/kgbnf.g4 by ANTLR 4.13.2
+
+// Unreachable code detected
+#pragma warning disable 0162
+// The variable '...' is assigned but its value is never used
+#pragma warning disable 0219
+// Missing XML comment for publicly visible type or member '...'
+#pragma warning disable 1591
+// Ambiguous reference in cref attribute
+#pragma warning disable 419
+
+namespace SysML2.NET.CodeGenerator.Grammar {
+using Antlr4.Runtime.Misc;
+using Antlr4.Runtime.Tree;
+using IToken = Antlr4.Runtime.IToken;
+
+///
+/// This interface defines a complete generic visitor for a parse tree produced
+/// by .
+///
+/// The return type of the visit operation.
+[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")]
+[System.CLSCompliant(false)]
+public interface IkgbnfVisitor : IParseTreeVisitor {
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitSpecification([NotNull] kgbnfParser.SpecificationContext context);
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitRule_definition([NotNull] kgbnfParser.Rule_definitionContext context);
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitAlternatives([NotNull] kgbnfParser.AlternativesContext context);
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitAlternative([NotNull] kgbnfParser.AlternativeContext context);
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitElement([NotNull] kgbnfParser.ElementContext context);
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitGroup([NotNull] kgbnfParser.GroupContext context);
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitTerminal([NotNull] kgbnfParser.TerminalContext context);
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitImage([NotNull] kgbnfParser.ImageContext context);
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitEdge_end([NotNull] kgbnfParser.Edge_endContext context);
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitNon_terminal([NotNull] kgbnfParser.Non_terminalContext context);
+ ///
+ /// Visit a parse tree produced by .
+ ///
+ /// The parse tree.
+ /// The visitor result.
+ Result VisitSuffix_op([NotNull] kgbnfParser.Suffix_opContext context);
+}
+} // namespace SysML2.NET.CodeGenerator.Grammar
diff --git a/SysML2.NET.CodeGenerator/Grammar/GrammarLoader.cs b/SysML2.NET.CodeGenerator/Grammar/GrammarLoader.cs
index ec6e1d6a5..c9259afc8 100644
--- a/SysML2.NET.CodeGenerator/Grammar/GrammarLoader.cs
+++ b/SysML2.NET.CodeGenerator/Grammar/GrammarLoader.cs
@@ -9,7 +9,9 @@
namespace SysML2.NET.CodeGenerator.Grammar
{
+ using System.Collections.Generic;
using System.IO;
+ using System.Linq;
using Antlr4.Runtime;
@@ -45,5 +47,122 @@ public static TextualNotationSpecification LoadTextualNotationSpecification(stri
var explorer = new TextualNotationSpecificationVisitor();
return (TextualNotationSpecification)explorer.Visit(tree);
}
+
+ ///
+ /// Loads the , with each production's definitions merged
+ ///
+ /// The string uri that locates the KGBNF file to load
+ /// The loaded , holding one per production name
+ /// If does not locate an existing
+ /// If the grammar is not valid graphical notation
+ public static GraphicalNotationSpecification LoadGraphicalNotationSpecification(string fileUri)
+ {
+ if (!File.Exists(fileUri))
+ {
+ throw new FileNotFoundException("File not found", fileUri);
+ }
+
+ var syntaxErrors = new SyntaxErrorCollector();
+ var tree = CreateGraphicalParser(GraphicalGrammarErrata.ApplyProductions(File.ReadAllText(fileUri)), syntaxErrors).specification();
+ syntaxErrors.ThrowIfAny(fileUri);
+
+ return MergeProductions((GraphicalNotationSpecification)new GraphicalNotationSpecificationVisitor().Visit(tree));
+ }
+
+ ///
+ /// Creates a over graphical notation text that reports every lexer and parser error to a collector
+ ///
+ /// The graphical notation text
+ /// The receiving the errors
+ /// The
+ private static kgbnfParser CreateGraphicalParser(string source, SyntaxErrorCollector syntaxErrors)
+ {
+ var lexer = new kgbnfLexer(CharStreams.fromString(source));
+ lexer.RemoveErrorListeners();
+ lexer.AddErrorListener(syntaxErrors);
+
+ var parser = new kgbnfParser(new CommonTokenStream(lexer));
+ parser.RemoveErrorListeners();
+ parser.AddErrorListener(syntaxErrors);
+
+ return parser;
+ }
+
+ ///
+ /// Merges every definition of a production name into one , in declaration order
+ ///
+ /// The holding one rule per definition
+ /// The holding one rule per production name
+ ///
+ /// Partial productions (=|) distribute their alternatives across definitions (SysML 2.0 §8.2.3.1).
+ ///
+ private static GraphicalNotationSpecification MergeProductions(GraphicalNotationSpecification specification)
+ {
+ var merged = new GraphicalNotationSpecification();
+
+ merged.Rules.AddRange(specification.Rules.GroupBy(rule => rule.RuleName).Select(definitions =>
+ {
+ var production = new GraphicalNotationRule
+ {
+ RuleName = definitions.Key,
+ IsPartial = definitions.Any(definition => definition.IsPartial)
+ };
+
+ production.Alternatives.AddRange(definitions.SelectMany(definition => definition.Alternatives));
+ return production;
+ }));
+
+ return merged;
+ }
+
+ ///
+ /// Collects the lexer and parser errors raised while reading graphical notation
+ ///
+ private sealed class SyntaxErrorCollector : IAntlrErrorListener, IAntlrErrorListener
+ {
+ ///
+ /// Gets the collected error messages, each prefixed with its line and column
+ ///
+ private List Messages { get; } = [];
+
+ ///
+ /// Records a lexer error
+ ///
+ /// The output the error would be written to
+ /// The lexer
+ /// The offending character
+ /// The line of the error
+ /// The column of the error
+ /// The error message
+ /// The recognition exception, if any
+ public void SyntaxError(TextWriter output, IRecognizer recognizer, int offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
+ => this.Messages.Add($"{line}:{charPositionInLine} {msg}");
+
+ ///
+ /// Records a parser error
+ ///
+ /// The output the error would be written to
+ /// The parser
+ /// The offending token
+ /// The line of the error
+ /// The column of the error
+ /// The error message
+ /// The recognition exception, if any
+ public void SyntaxError(TextWriter output, IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
+ => this.Messages.Add($"{line}:{charPositionInLine} {msg}");
+
+ ///
+ /// Rejects text that could not be read in full
+ ///
+ /// The name of the read source, reported in the exception
+ /// If any error was collected
+ public void ThrowIfAny(string source)
+ {
+ if (this.Messages.Count > 0)
+ {
+ throw new InvalidDataException($"'{source}' is not valid graphical notation: {string.Join("; ", this.Messages)}");
+ }
+ }
+ }
}
}
diff --git a/SysML2.NET.CodeGenerator/Grammar/GraphicalNotationSpecificationVisitor.cs b/SysML2.NET.CodeGenerator/Grammar/GraphicalNotationSpecificationVisitor.cs
new file mode 100644
index 000000000..d46ff525a
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Grammar/GraphicalNotationSpecificationVisitor.cs
@@ -0,0 +1,131 @@
+// ------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+// SPDX-License-Identifier: Apache-2.0
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.Grammar
+{
+ using System.Collections.Generic;
+ using System.Linq;
+
+ using SysML2.NET.CodeGenerator.Grammar.Model;
+
+ ///
+ /// Custom to read a
+ ///
+ public class GraphicalNotationSpecificationVisitor : kgbnfBaseVisitor