Which formal language class are XML and JSON with unique keys (they are not context-free) -
please don't answer here @ cstheory.stackexchange, i copied question to!
json , xml both called context-free languages - both specified formal grammar in ebnf. true json defined in rfc 4329, section 2.2 not require uniqueness of object keys (many may not know {"a":1,"a":2} valid json!). if require unique keys in json or unique attribute names in xml cannot expressed context-free grammars. language class of json unique keys , well-formed xml (which implies unique attribute names?).
one of best paper found on subject (murato et al, 2001: taxonomy of xml schema languages using formal language theory) explicitly excludes integrity constraints such keys/keyrefs , uniqueness checked on additional layer. beside subset of xml defined xml schema or dtd context-free. not full set of well-formed xml documents.
i think nested stack automaton (=indexed language) should able parse json unique key constraint. xml can simlify question language s of comma-seperated lists of unique integers. know more, preferably citations?
p.s: simple algorithm decide languages (beside context-free part) based on sorting algorithm. therefore should decidable in "linearithmic time" o(n log n) worst case. have not found out yet, whether complexity class instance "mildly context-sensitive", or "indexed" between context-free , context-sensitive (?).
Comments
Post a Comment