What formal language class are XML and JSON with unique keys (they are not contextual)

Please do not answer here, but in cstheory.stackexchange, where I copied this question to !

JSON and XML are often referred to as context-free languages ​​- both of which are defined mainly by formal grammar in EBNF. However, this is true only for JSON, as defined in RFC 4329, section 2.2 , which does not require uniqueness of object keys (many may not know, but {"a": 1, "a": 2} valid JSON!). But if you need unique keys in JSON or unique attribute names in XML , this cannot be expressed by context-free grammars. But which JSON language class has unique keys and well-formed XML (what does unique attribute names mean?).

One of the best articles I have found on this topic (Murato et al, 2001: Taxonomy of XML Schema Languages ​​Using Formal Language Theory ) explicitly eliminates integrity constraints such as keys / keyrefs and uniqueness that need to be verified at an additional level. In addition, a subset of XML defined by an XML Schema or DTD has no context. But not a complete set of all well-formed XML documents.

I think that a nested stack automaton (= indexed language) should be able to parse JSON with a unique key constraint. XML can simplify the S language question of all comma-separated lists of unique integers. Does anyone know more, preferably with quotes?

PS: A simple algorithm for solving languages ​​(in addition to the context-free part) is based on a good sorting algorithm. Therefore, it must be solvable at "linearithmic time" with O (n log n) worst case. I have not yet figured out whether the complexity class is “softly context-sensitive” or “indexed”, but there is probably something in between the context-sensitive and the context-sensitive (?).

+3
source share

Source: https://habr.com/ru/post/1756563/


All Articles