merged presentation syntax (MPS)

I've been toying with an idea for the past week or two, and I've now
implemented enough of it that I'm pretty sure it's a good idea.

The idea is to have one presentation syntax for all dialects.  This
"merged" presentation syntax would be essentially the union of all RIF
dialects.  Its grammar would NOT attempt to enforce any of the
restrictions of each dialect; that would be left to a higher "schema"
level.

So, for instance, in MPS, it's perfectly valid syntax to say:
    
    forall ?x ( ?x(1) )

even though that kind of higher-order construct isn't valid in any
current dialect.  Moreover, MPS makes no attempt to enforce the
difference between formulas and terms, so it's syntactically valid to say:

    (x:p(3) and x:q(x:p(3)+1)) < 4
 
The idea is that it's left to the dialect definition/schema to say
whether that's valid in the particular dialect.  In either case, it
still has a well-defined mapping to XML.

Part of my playing around with MPS has been to see if I can add the
things I'd like to see in a PS to make it more readable.  For example, I
prefer "if" and "then" to an infix operator.  I propose that we let the
person authoring a particular MPS document decide which to use.  (In
some situations there might be style guidelines, eg saying to use ":-"
or to not use ":-", but that's just style.  Both are available in the
language, as is "=>" for infix if-then.)

Here are some things in the current (unambiguous LALR) grammar:

    -- infix operators for math and logic, with the normal
       precedence rules
    -- parens allowed everywhere, to override precedence
    -- "if" and "then" keywords, in addition to ":-" and "=>"
    -- variables not needing the leading "?"
    -- local symbols required to have a leading "_" (as in DTB but
       not in example 4 of BLD), or alternatively declared as local
       in the header
    -- keywords True and False (for rif:And() and rif:Or())
    -- keywords InstanceOf and SubclassOf allowed along with # and ##
    -- optional comma separator for arguments
    -- optional semicolon separator for elements (formulas) in a group
    -- bare uris and curies are allowed everywhere, although you have to
       be a little careful in using them, since their syntax includes
       some operators    ( "p:x-3" is one curie; it's not "p:x - 3" ).
       I'm torn about using qnames instead to avoid this problem.
    -- Document and Group wrappers are optional
    -- headers (eg Base(...)) and metadata can be given before ANY expression
    -- and finally, as an experiment, I threw in { ... } for blocks of
       N3 triples (another frame syntax, common in the semantic web
       community).  (it's not full n3 -- the term syntax within the
       triples is MPS's term syntax, no N3's.)

The code isn't done enough for me to say with confidence whether it's
currently a superset of the BLD PS, but I've tried to make it so.

I hope to be able to demo it, and run it against the test cases, in a
few days....

The current MPS BNF is here:  http://dev.w3.org/2009/rif/mps.bnf

       -- Sandro

Received on Friday, 13 February 2009 21:13:39 UTC