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 application 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 application variable assignment'
			'tail': component 'interface context id path'
		}
	)
}

Node type mapping


'node type mapping' { [ (, ) ]
	'attributes': dictionary {
		'type': [ : ] stategroup (
			'command' { [ command ]
				'variable assignment': component 'optional variable assignment'
				'implementation': component 'command mapping'
			}
			'property' {
				'type': stategroup (
					'collection' { [ collection ]
						'type': stategroup (
							'empty' { [ = empty ] }
							'dynamic' {
								'key constraint': stategroup (
									'no' { [ = ]
										'key constructor': component 'key constructor'
										'branch definer': stategroup (
											'state group' {
												'path': component 'conditional node path'
												'state group': [ . ] reference
											}
											'implementation' { }
										)
									}
									'yes' { [ ->, = ]
										'referencer': group {
											'head': component 'singular imp node path'
											'collection': [ . ] reference
										}
									}
								)
								'first branch': reference = first
								'branches': [ (, ) ] dictionary {
									'has successor': stategroup = node-switch successor (
										| node = 'yes' { 'successor' = successor }
										| none = 'no'
									)
									/* 'tail' is a referencer extension for collections with key constraint */
									'tail': component 'conditional descendant imp node path'
									'expression': [ = ] component 'collection expression'
									'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' {
								'head': [ -> ] component 'singular imp node path'
								'collection': [ ., [] ] reference
								'tail': component 'conditional descendant imp node path'
								'branch': [ = from ] reference
								'expression': [ [, ] ] component 'singular node path'
							}
						)
					}
					'file' { [ file ]
						'expression': [ = ] component 'file expression'
					}
				)
			}
		)
	}
}

Command mapping expressions


'command mapping' { [ => ]
	'path': [ execute ] component 'singular node path'
	'command': [ . ] reference
	'parameter mapping': component 'parameter mapping'
}
'parameter mapping' { [ (, ) ]
	'properties': dictionary {
		'type': [ : ] stategroup (
			'group' { [ group = ]
				'path': component 'context interface node path'
				'group': [ . ] reference
				'variable assignment': component 'optional variable assignment'
				'mapping': component 'parameter mapping'
			}
			'collection' { [ collection = ]
				'path': component 'context interface node path'
				'collection': [ ., * ] reference
				'variable assignment': component 'optional variable assignment'
				'mapping': component 'parameter mapping'
			}
			'number' { [ number = ]
				'path': component 'context interface node path'
				'number': [ . ] reference
			}
			'text' { [ text ]
				'type': stategroup (
					'parameter' { [ = ]
						'path': component 'context interface node path'
						'text': [ . ] reference
					}
					'variable' { [ = ]
						'path': component 'context node path'
					}
					'reference variable' {
						'referencer': [ -> ] group {
							'head': component 'parametrized singular imp node path'
							'collection': [ ., [] ] reference
							'tail': component 'conditional descendant imp node path'
						}
						'path': [ = ] group {
							'path': component 'context interface node path'
							'reference': [ > ] reference
							'tail': component 'context node path'
						}
					}
				)
			}
			'file' { [ file = ]
				'path': component 'context interface node path'
				'file': [ . ] reference
			}
			'state group' { [ stategroup ]
				'type': [ = ] stategroup (
					'state' {
						'state': reference
						'mapping': component 'parameter mapping'
					}
					'state switch' { [ switch ]
						'path': component 'context interface node path'
						'state group': [ . ] reference
						'states': [ (, ) ] dictionary { [ | ]
							'variable assignment': component 'optional variable assignment'
							'target state': [ => ] reference
							'mapping': component 'parameter mapping'
						}
					}
					'branch switch' { [ switch ]
						'path': group {
							'head': component 'parametrized singular imp node path'
							'collection': [ . ] reference
							'key': group { [ [, ] ]
								'path': component 'context interface node path'
								'reference': [ > ] reference
							}
						}
						'branches': [ (, ) ] dictionary { [ | ]
							'bind to branch context': stategroup (
								'no' { }
								'yes' { [ bind ] }
							)
							'state': [ => ] reference
							'mapping': component 'parameter mapping'
						}
					}
				)
			}
		)
	}
}

Property mapping expressions


Texts, numbers and files

'text expression' {
	'path': component 'singular node path'
	'text': [ . ] reference
}
'number expression' {
	'type': stategroup (
		'unary' {
			'type': stategroup (
				'absolute value' { [ abs ] }
				'sign inversion' { [ - ] }
			)
			'expression': component 'number expression'
		}
		'dynamic' { // use value exp instead
			'path': component 'singular node path'
			'number': [ . ] reference
		}
	)
}
'file expression' {
	'path': component 'singular node path'
	'file': [ . ] reference
}

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 'node step'
				}
				'plural' {
					'step': component 'plural descendant node step'
				}
			)
			'variable assignment': component 'optional application variable assignment2'
			'tail': component 'collection expression tail'
		}
	)
}
'filter expression' {
	'has rules': stategroup = node-switch .'rules' (
		| nodes = 'yes' { 'first' = first }
		| none  = 'no'
	)
	'rules': dictionary { [ where ]
		'has successor': stategroup = node-switch successor (
			| node = 'yes' { 'successor' = successor }
			| none = 'no'
		)
		'node path': [ -> ] component 'conditional node path'
		'type': stategroup (
			'existence' { }
			'equality' {
				'expected node path': [ is (, ) ] component 'conditional 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 (
		'state' {
			'state': reference
			'node': component 'node type mapping'
		}
		'state switch' { [ switch ]
			'path': component 'singular node path'
			'state group': [ . ] reference
			'states': [ (, ) ] dictionary { [ | ]
				'variable assignment': component 'optional application variable assignment'
				'target state': [ => ] reference
				'node': component 'node type mapping'
			}
		}
	)
}

'optional variable assignment' {
	'has assignment': stategroup (
		'no' { }
		'yes' {
			'assignment': component 'variable assignment'
		}
	)
}
'optional application variable assignment' {
	'assignment': component 'optional variable assignment'
}
'optional application variable assignment2' {
	'variable assignment': stategroup (
		'no' { }
		'yes' {
			'assignment': component 'variable assignment'
			'break': component 'break'
		}
	)
}
'variable step' {
	'name': stategroup (
		'implicit' { [ $ ] }
		'explicit' {
			'head': component 'ancestor variable path'
			'named object': [ $ ] reference
		}
	)
}
'variable assignment' {
	'name': [ as ] stategroup (
		'implicit' { [ $ ] }
		'explicit' {
			'name': reference = first
			'named objects': dictionary { [ $ ]
				'has successor': stategroup = node-switch successor (
					| node = 'yes' { }
					| none = 'no'
				)
			}
		}
	)
}
'ancestor variable path' {
	'has steps': stategroup (
		'no' { }
		'yes' { [ $^ ]
			'tail': component 'ancestor variable path'
		}
	)
}
'context node path' {
	'type': stategroup (
		'root' { [ root ] }
		'variable' {
			'type': stategroup (
				'rule' {
					'head': component 'ancestor variable path'
					'rule': [ .& ] reference
				}
				'variable' {
					'step': component 'variable step'
				}
			)
		}
	)
}
'context interface node path' {
	'step': component 'variable step'
}
'node path tail' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'step': component 'node step'
			'tail': component 'node path tail'
		}
	)
}
'dependency step' {
	'type': stategroup (
		'reference' {
			'text': [ > ] reference
		}
		'reference rule' {
			'text': [ . ] reference
			'rule': [ & ] reference
		}
		'state rule' {
			'rule': [ .& ] reference
		}
	)
}
'node step' {
	'type': stategroup (
		'group' { [ . ]
			'group': reference
		}
		'dependency' {
			'dependency': component 'dependency step'
		}
		'state' {
			'state group': [ . ] reference
			'state': [ ? ] reference
		}
		'collection entry' {
			'collection': [ . ] reference
			'key': [ [, ] ] group {
				'key source': stategroup (
					'key reference' {
						/* The node that the entry key value should point to. */
						/* NOTE: currently, only the key value (text) is matched. */
						'node path': component 'conditional node path'
					}
					// 'context key' {
					// 	'context key': [ @ ] reference
					// }
				)
			}
		}
	)
}
'singular node path' {
	'head': component 'context node path'
	'tail': component 'node path tail'
}
'conditional node path' {
	'head': component 'context node path'
	'tail': component 'node path tail'
}
'plural descendant node step' {
	'collection': [ ., * ] reference
}

Expressions for mapping safety


'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'
		}
	)
}
'parametrized singular imp node path' {
	'has steps': stategroup (
		'no' { }
		'yes' {
			'type': stategroup (
				'parent' { [ ^ ] }
				'collection entry' {
					'collection': [ . ] reference
					'key': [ [, ] ] group {
						'path': component 'ancestor variable path'
						'reference': [ $ > ] reference
					}
				}
				'group' {
					'group': [ . ] reference
				}
			)
			'tail': component 'parametrized singular imp node path'
		}
	)
}
'break' { }