The minimal implementation


Every provided interface implementation contains at least

root = root /* context path goes here */ ( /* node type mapping */ )
'variable assignment': [ root = root ] component 'optional variable assignment'
'application root node': component 'interface context id path'
'root': component 'node type mapping'

Context identification path


This path can be used for expressing the context node for an interface (the interface root).

'interface context id path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'collection entry' {
					'collection': [ ., [ ] reference
					'id': [ @, ] ] reference
				}
				'group' { [ + ]
					'group': reference
				}
				'state' { [ ? ]
					'state group': reference
					'state': [ | ] reference
				}
			)
			'variable assignment': component 'optional variable assignment'
			'tail': component 'interface context id path'
		}
	)
}

Node type mapping


'node type mapping' { [ (, ) ]
	'attributes': dictionary {
		'type': [ : ] stategroup (
			'command' { [ command ]
				'implementation': component 'command mapping'
			}
			'property' {
				'type': stategroup (
					'collection' { [ collection ]
						'type': stategroup (
							'empty' { [ = empty ] }
							'dynamic' {
								'key constraint': stategroup (
									'no' { [ = ]
										'key constructor': component 'key constructor'
									}
									'yes' { [ ->, = ]
										'referencer': group {
											'head': component 'singular imp node path'
											'collection': [ . ] reference
											'branches': [ (, ) ] dictionary { [ -| ]
												'tail': component 'conditional descendant imp node path'
											}
										}
									}
								)
								'has branch': stategroup = node-switch .'branches' (
									| nodes = 'yes' { 'first' = first }
									| none  = 'no'
								)
								'branches': [ (, ) ] dictionary {
									'has successor': stategroup = node-switch successor (
										| node = 'yes' { 'successor' = successor }
										| none = 'no'
									)
									'expression': [ = ] component 'collection expression'
									'key constraint': stategroup (
										'no' { }
										'yes' { [ (, ) ]
											'branch': [ from ] reference
											'key path': [ >[, ] ] component 'collection key node path'
										}
									)
									'node': component 'node type mapping'
								}
							}
						)
					}
					'group' { [ group ]
						'expression': [ = ] component 'group expression'
						'node': component 'node type mapping'
					}
					'number' { [ number ]
						'expression': [ = ] component 'number expression'
					}
					'state group' { [ stategroup ]
						'expression': [ = ] component 'state expression'
					}
					'text' { [ text ]
						'has constraint': stategroup (
							'no' {
								'expression': [ = ] component 'text expression'
							}
							'yes' {
								'referencer': [ -> ] group {
									'head': component 'singular imp node path'
									'collection': [ . ] reference
									'branch': [ -| ] reference
									'tail': component 'conditional descendant imp node path'
								}
								'expression': [ = ] component 'reference expression'
							}
						)
					}
					'file' { [ file ]
						'expression': [ = ] component 'file expression'
					}
				)
			}
		)
	}
}

Command mapping expressions


'command mapping' { [ do ]
	'path': [ on ] component 'singular node path'
	'command': [ ( ] reference
	'parameter mapping': [ with, ) ] component 'parameter mapping'
}
'parameter mapping' { [ (, ) ]
	'properties': dictionary {
		'type': [ : ] stategroup (
			'group' { [ group = ]
				'group': [ @ . ] reference
				'parameter mapping': component 'parameter mapping'
			}
			'collection' { [ collection ]
				'collection': [ = map @ . ] reference
				'parameter mapping': component 'parameter mapping'
			}
			'number' { [ number ]
				'number': [ = @ # ] reference
			}
			'text' { [ text ]
				'type': [ = ] stategroup (
					'parameter' {
						'text': [ @ . ] reference
					}
					'variable' {
						'path': component 'context node path'
					}
				)
			}
			'file' { [ file ]
				'file': [ = @ / ] reference
			}
			'state group' { [ stategroup ]
				'type': [ = ] stategroup (
					'fixed' {
						'state': reference
						'parameter mapping': component 'parameter mapping'
					}
					'map' { [ switch @ ]
						'state group': [ ? ] reference
						'mapping': [ (, ) ] dictionary { [ | ]
							'mapped state': [ = ] reference
							'parameter mapping': component 'parameter mapping'
						}
					}
					'match branch' { [ match-branch ]
						'path': group {
							'head': component 'parametrized singular imp node path'
							'collection': [ . ] reference
							'reference': [ [ @ >, ] ] reference
						}
						'branches': [ (, ) ] dictionary { [ | ]
							'state mapping context variable': stategroup (
								'current variable' { }
								'branch context variable' { [ bind $ ] }
							)
							'state': [ = ] reference
							'parameter mapping': component 'parameter mapping'
						}
					}
				)
			}
		)
	}
}

Property mapping expressions


Texts, numbers, files, and references

'text expression' {
	'path': component 'singular node path'
	'text': [ . ] reference
}
'number expression' {
	'path': component 'singular node path'
	'number': [ # ] reference
}
'file expression' {
	'path': component 'singular node path'
	'file': [ / ] reference
}
'reference expression' {
	'path': component 'singular node path'
	'text': [ > ] reference
	'key path': [ (, ) ] component 'collection key node path'
}

Collections

'key separator' {
	'separator': [ join ] stategroup (
		'dot' { [ . ] }
		'dash' { [ - ] }
		'colon' { [ : ] }
		'greater than' { [ > ] }
		'space' { [ space ] }
	)
}
'key constructor' {
	'branch concatenation': stategroup (
		'yes' {
			'type': stategroup (
				'prepend' { [ prepend-branch ] }
				'append' { [ append-branch ] }
			)
		}
		'no' { }
	)
	'key separator': stategroup (
		'yes' {
			'key separator': component 'key separator'
		}
		'no' { }
	)
}
'collection expression' {
	'head': component 'context node path'
	'tail': component 'collection expression tail'
}
'collection expression tail' {
	'has steps': stategroup (
		'no' {
			'filter': component 'filter expression'
		}
		'yes' {
			'type': stategroup (
				'singular' {
					'step': component 'singular node step'
				}
				'conditional' {
					'step': component 'conditional descendant node step'
				}
				'plural' {
					'step': component 'plural descendant node step'
				}
			)
			'variable assignment': component 'optional variable assignment'
			'tail': component 'collection expression tail'
		}
	)
}
'filter expression' {
	'has filter': stategroup (
		'no' { }
		'yes' { [ where ]
			'has filters': stategroup = node-switch .'filters' (
				| nodes = 'yes' { 'first' = first }
				| none  = 'no'
			)
			'filters': [ (, ) ] dictionary { [ $ ]
				'has successor': stategroup = node-switch successor (
					| node = 'yes' { 'successor' = successor }
					| none = 'no'
				)
				'type': stategroup (
					'singular result' {
						'path': [ = ] component 'conditional node path'
					}
					'equality' { [ = equal ]
						'left path': [ ( ] component 'singular node path'
						'right path': [ ,, ) ] component 'singular node path'
					}
				)
			}
		}
	)
}

Groups and stategroups

'group expression' {
	'type': stategroup (
		'none' { }
		'bound' {
			'path': component 'singular node path'
			'variable assignment': component 'variable assignment'
		}
	)
}
'state expression' {
	'type': stategroup (
		'static' {
			'state': reference
			'node': component 'node type mapping'
		}
		'dynamic' { [ switch ]
			'path': component 'singular node path'
			'state group': [ ? ] reference
			'states': [ (, ) ] dictionary { [ | ]
				'variable assignment': component 'optional variable assignment'
				'state': [ = ] reference
				'node': component 'node type mapping'
			}
		}
	)
}

'optional variable assignment' {
	'has assignment': stategroup (
		'no' { }
		'yes' {
			'assignment': component 'variable assignment'
		}
	)
}
'variable assignment' { [ as $ ] }
'ancestor variable path' {
	'has steps': stategroup (
		'no' { [ $ ] }
		'yes' { [ $^ ]
			'tail': component 'ancestor variable path'
		}
	)
}
'context node path' {
	'type': stategroup (
		'root' { [ root ] }
		'variable' {
			'head': component 'ancestor variable path'
			'type': stategroup (
				'variable' { }
				'filter' {
					'filter': reference
				}
			)
		}
	)
}
'singular node path' {
	'head': component 'context node path'
	'tail': component 'singular node path tail'
}
'singular node path tail' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'step': component 'singular node step'
			'tail': component 'singular node path tail'
		}
	)
}
'singular node step' {
	'type': stategroup (
		'group' { [ + ]
			'group': reference
		}
		'reference' {
			'text': [ > ] reference
		}
		'reference rule' {
			'text': [ . ] reference
			'rule': [ & ] reference
		}
		'state rule' {
			'rule': [ & ] reference
		}
	)
}
'conditional node path' {
	'head': component 'context node path'
	'tail': component 'conditional node path tail'
}
'conditional node path tail' {
	'head': component 'singular node path tail'
	'has steps': stategroup (
		'no' { }
		'yes' {
			'step': component 'conditional descendant node step'
			'tail': component 'conditional node path tail'
		}
	)
}
'conditional descendant node step' {
	'type': stategroup (
		'state' {
			'state group': [ ? ] reference
			'state': [ | ] reference
		}
		'collection entry' {
			'collection': [ . ] reference
			'key': [ [, ] ] group {
				'path': component 'singular node path'
				'key source': stategroup (
					'link' {
						'text': [ |> ] reference
					}
					'node' { }
				)
			}
		}
	)
}
'plural descendant node step' {
	'collection': [ ., * ] reference
	'legacy annotation': stategroup (
		'base' { }
		'derived' { [ (derived) ] }
	)
}

Expressions for mapping safety


'collection key node path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'reference' { [ > ]
					'text': reference
				}
				'parent' { [ ^ ] }
				'filter' { [ $ ]
					'filter': reference
				}
			)
			'tail': component 'collection key node path'
		}
	)
}
'conditional descendant branch imp node path' {
	'type': stategroup (
		'static' { }
		'dynamic' {
			'state': [ | ] reference
		}
	)
}
'conditional descendant imp node path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'state' { [ ? ]
					'state group': reference
					'path': component 'conditional descendant branch imp node path'
				}
				'group' { [ + ]
					'group': reference
				}
			)
			'tail': component 'conditional descendant imp node path'
		}
	)
}
'singular imp node path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'parent' { [ ^ ] }
				'group' { [ + ]
					'group': reference
				}
				'reference' { [ > ]
					'reference': reference
				}
			)
			'tail': component 'singular imp node path'
		}
	)
}
'ancestor parameter path' {
	'has steps': stategroup (
		'no' { [ @ ] }
		'yes' {
			'type': stategroup (
				'state parent' { [ @?^ ] }
				'collection parent' { [ @.^ ] }
			)
			'tail': component 'ancestor parameter path'
		}
	)
}
'parametrized singular imp node path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'collection entry' {
					'collection': [ . ] reference
					'single branch': stategroup (
						'yes' { }
					)
					'key': [ [, ] ] group {
						'path': component 'ancestor parameter path'
						'reference': [ > ] reference
					}
				}
				'group' {
					'group': [ + ] reference
				}
			)
			'tail': component 'parametrized singular imp node path'
		}
	)
}