The minimal formulation of the Jevko grammar is very flexible.
In certain contexts though it may be more advantageous to use an alternative grammar which is more rigid.
In particular the following grammar:
Value = Subvalues Suffix
Subvalue = Prefix "[" Value "]"
Subvalues = *Subvalue
Suffix = *Char
Prefix = *Char
Char = Escape / %x0-5a / %x5c / %x5e-5f / %x61-10ffff
Escape = "`" ("`" / "[" / "]")
matches the same strings as the minimal grammar, except that it is unambiguous in terms of ABNF semantics and it enforces certain structure in parse trees that it generates.
For example the following string:
Prefix 1 [Suffix 1]
Prefix 2 [
Prefix 2.1 [Suffix 2.1]
Prefix 2.2 [Suffix 2.2]
Suffix 2
]
Prefix 3 [Suffix 3]
Suffix
Can be visualised with the following parse tree:
Note:
In other words the string serializes the tree in such a way that:
© 2022 Darius J Chuck