ERights Home elang / quasi 
Back to: Textual Quasi-Literals 1st child: Term Trees: The Spec On to: XML Processing by Quasi-Literals

Quasi-Literals


John McCarthy has said: "XML is just S-Expressions, only ten times as verbose." This comparison is too kind to XML. What XML, S-Expressions, Antlr ASTs (abstract syntax trees), and Prolog Term trees have in common is that they are simple(*) notations (or surface syntaxes) for simple(*) "practically universal" trees of symbols. These trees are "practically universal" in that many other forms of symbolic data can be mapped into any of these trees. (For a contrary view, see Paul Prescod's XML is not S-Expressions.)

The clearest and most compelling case is the Antlr AST -- these are used to represent the result of parsing anything that can be parsed according to a BNF grammar. This demonstrates that one such universal data structures may have a great multitude of surface syntaxes.

Although the Antlr documentation also calls these S-Expressions, and although the Antlr notation for writing them looks like S-Expressions, semantically they are actually most similar to Prolog Term trees. Since Antlr is the system we most desire to interoperate with, as of this release we introduce E's Prolog-like Term trees, with conversions back and forth to Antlr ASTs.

In an E Term, a functor is a tag or a literal data element. A literal data element is either a literal character, integer, floating point number, or string, written the same way, and meaning the same thing, as these literal data elements do in E. (This is the same as they do in Java, except that integers are precision unlimited, and floating point numbers are always double precision.) A Term always consists of a functor and zero or more arguments. These arguments are its children, which transitively always form a finite tree. The leaves of the tree are simply Terms with no arguments.

Term-Tree Specification

Quasi-Literal Term Tree Specification

The Power of Ellipses

 
Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
ERights Home elang / quasi 
Back to: Textual Quasi-Literals 1st child: Term Trees: The Spec On to: XML Processing by Quasi-Literals
Download    FAQ    API    Mail Archive    Donate

report bug (including invalid html)

Golden Key Campaign Blue Ribbon Campaign