OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

relax-ng message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: Fw: [relax-ng] Use of attribute grammars for A.1


My mail was encoded in ISO-2022-JP, since it contains the character "epsilon".  
Let me try again.

Cheers,

Makoto

----------------------- Original Message -----------------------
 From:    EB2M-MRT@asahi-net.or.jp (Murata Makoto)
 To:      relax-ng@lists.oasis-open.org
 Date:    Fri, 23 Aug 2002 11:45:27 +0900
 Subject: [relax-ng] Use of attribute grammars for A.1
----

I think that the BNF in A.1 is equivalent to an attribute grammar with
a synthesized attribute for constructing an XML-synax grammar and an
inherited attribute for representing contexts (i.e., a set of
prefix-URI bindings).

If we use the syntax of attribute grammars, we have:

topLevel  ::=  preamble  topLevelBody

        { topLevel.value = topLevelBody.value
          topLevelBody.context = preamble.context }

preamble_1  ::=
    epsilon
        { preamble_1.value = preamble_1.context}

    |  decl  preamble_2
        { preamble_2.context = decl.context
	  preamble_1.value = preamble_2.value}

decl  ::= "namespace"  namespacePrefix  "="  namespaceURILiteral

        Constraint: xml prefix
        Constraint: xml namespace URI
        Constraint: duplicate declaration

        { decl.value =
             bindPrefix(decl.context, 
                        namespacePrefix.value, 
                        namespaceURILiteral.value) }

....

Yes, this is wordy.  But this is easy for me to read.  Many people
already know how to read this notation.  For example, see [1]

We can make the above description more compact.  We can 
separate equations for synthesized attributes and those 
for inherited attributes.  We can even omit attribute names 
(i.e., "context" and "value"), since we have only one synthesized 
attribute and one inherited attribute.

[1] http://www-rocq.inria.fr/oscar/www/fnc2/manual/node32.html#SECTION02400000000000000000

Makoto

----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>

--------------------- Original Message Ends --------------------

-- 
MURATA Makoto (FAMILY Given) <EB2M-MRT@asahi-net.or.jp>



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC