This allows the most concise possible description of graph metadata. It allows the format to be validated. And since the keywords used in these expressions are not metafunctions but just tokens to be matched, they can have different meaning in different grammars and contexts.

The matching is done by a DFA with a stack, implemented on MPL.Graph. At each level of the expression, the DFA follows transitions matching items in the current list. A transition can recurse into the deeper level of the expression, in which case a new stack frame is created with new data and a new start state. The transition is labeled with semantic actions for before and after recursing.

Next up: a language for specifying these DFA’s nicely. Right now it’s kind of messy: