Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML, S-Expressions, and overlapping scope... What's it called?

I was reading XML is not S-Expressions. XML scoping is kind of strict, as are S-expressions. And in every programming language I've seen, you can't have the following:

<b>BOLD <i>BOTH </b>ITALIC</i> == BOLD BOTH ITALIC

It's not even expressible with S-Expressions:

(bold "BOLD" (italic "BOTH" ) "ITALIC" ) == :(

Does any programming language support this kind of "overlapping" scoping? Could there be any practical use for it?

like image 795
Mr. White Avatar asked Aug 02 '10 02:08

Mr. White


1 Answers

Overlapping markup structures has many practical uses. Consider for example applications of concurrent markup for text analysis in the humanities. The International Workshop on Markup of Overlapping Structures noted that:

Overlapping structures are ubiquitous, appearing in applications of textual markup as varied as aircraft maintenance manuals and ancient scriptural and liturgical works. The “overlap issue“ raises its ugly head whenever text encoding looks beyond the snapshot view of a particular hierarchy to represent and process multiple concurrent aspects of a text, including features that reflect the text’s evolution across multiple versions and variants whether typographic or presentational, structural, annotational or referential, taxonomic or topical.

Overlap is a problem in texts as diverse as technical documents and product manuals (versioning), legal codes (effectivity), literary works (prosadic versus dramatic stucture, rhetorical structures, annotation), sacred texts (chapter plus verse reference versus sentence structure and commentary), and language corpora (multiple layers of linguistic annotation).

The Text Encoding Initiative (TEI) publishes Guidelines to handle non-nesting information and provides an XML syntax for overlap. They stated in 2004 that:

[N]o solution has yet been suggested which combines all the desirable attributes of formal simplicity, capacity to represent all occurring or imaginable kinds of structures, suitability for formal or mechanical validation, and clear identity with the notations needed for simpler cases (i.e. cases where the textual features do nest properly).

Some options to handle overlapping structures include:

SGML has a CONCUR feature that can be used to support overlapping structures, although Goldfarb (the author of the standard) writes that "“I therefore recommend that CONCUR not be used to create multiple logical views of a document".

GODDAG provides a data structure for representing documents with overlapping structures.

XCONCUR is an experimental markup language with the major goal to provide a convenient method to express concurrent hierarchies in an XML-like fashion.

like image 76
Terje Norderhaug Avatar answered Sep 22 '22 15:09

Terje Norderhaug