Altova Mailing List Archives


RE: [xml-dev] Syntax versus Semantics (was: "vocabulary constraints"

From: "Michael Kay" <mike@--------.--->
To: "'Costello, Roger L.'" <costello@-----.--->, <xml-dev@-----.---.--->
Date: 3/1/2009 7:14:00 PM
Unfortunately we can't use the word "semantics" without hitting the abuse of
the term that has always existed in the world of compilers, where everything
outside the BNF grammar (for example, a rule that you can't refer to a
variable that hasn't been declared) is traditionally referred to as
"semantics". As far as I can tell, this bears almost no relationship to the
use of the term by those studying natural languages, whose analog in
programming would be answering the question "what does the program do?", and
whose analog for XML would be "what information does the XML document convey
to the recipient?".

Because of this history of disparate meanings for the word, my own
preference is to avoid using it at all.

We're talking here about rules for deciding statically whether a document is
or is not a member of some set of valid documents, for example the set of
valid XSLT stylesheets. Building on Michael S-McQ's analysis, I would
suggest one might classify the validity rules according to the computational
power needed to express them:

(a) those rules that can be expressed using regular expressions

(b) those rules that can be expressed in BNF

(c) those rules that can be expressed in first-order predicate calculus
(e.g. XPath 2.0)

(d) those rules that can only be evaluated using a Turing machine.

XSD 1.1 gives us (a) and (c). I don't know whether (b) is a subset of (c) -
I suspect not. (Any theorists listening who can tell me?) In Saxon I'm also
allowing (d) by virtue of XPath assertions that call out to extension
functions written in Java - for example that allows you to test whether the
value of the select attribute in a stylesheet is indeed a valid XPath
expression.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Costello, Roger L. [mailto:costello@m...] 
> Sent: 01 March 2009 13:03
> To: 'xml-dev@l...'
> Subject: [xml-dev] Syntax versus Semantics (was: "vocabulary 
> constraints" and other constraints (was: Re: [xml-dev] RE: 
> Difference between "normalize" and "canonicalize"?))
> 
> 
> Michael Sperberg-McQueen wrote: 
> 
> > if we know how to specify it formally -- especially if we 
> can specify 
> > it in a way that doesn't require a Turing machine -- and check it 
> > automatically and conveniently, we tend to call it (whatever it is) 
> > syntax.  If we don't know how, then it's semantics.
> 
> Neat!
> 
> And Michael also wrote:
> 
> > One of the great themes of computer science over the last 
> sixty years 
> > has been the long-running campaign to move more and more 
> things out of 
> > the "must be checked by eyeball" / semantics area, and into 
> the "can 
> > readily be checked by machine" / syntax area.
> 
> 
> QUESTIONS
> 
> 1. If something is in the realm of "semantics" does that mean 
> it can only be processed by humans (eyeballs)? It cannot be 
> processed by machines?
> 
> 
> 2. If something is in the realm of "syntax" does that mean it 
> can be declaratively expressed, whereas something in the 
> realm of "semantics" can only be procedurally expressed?
> 
> 
> 3. Suppose that something can be expressed declaratively but 
> it takes pages and pages to express it. Is it still syntax?
> 
> 
> I'd like to take a stab at defining syntax and semantics, 
> incorporating 
> 
>    - the distinction of declarative versus procedural and 
>    - the distinction of simple to express versus complex:
> 
> 
> WHAT IS SYNTAX?
> 
> Something is syntax if it can be simply specified in a 
> declarative manner and it can be checked automatically and 
> conveniently.
> 
> 
> WHAT IS SEMANTICS?
> 
> Something is semantics if it cannot be simply specified in a 
> declarative manner or it requires procedural code to express it.
> 
> 
> Do you agree with these definitions?
> 
> /Roger
> ______________________________________________________________
> _________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by 
> OASIS to support XML implementation and development. To 
> minimize spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@l...
> subscribe: xml-dev-subscribe@l... List archive: 
> http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 


_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@l...
subscribe: xml-dev-subscribe@l...
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.