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: [relax-ng] Re: compact syntax: feedback from RelaxNGCC



> > The primary reason of this is that we need to quote all PCDATAs inside
> > elements.
> 
> The obvious solution to this is to provide an additional string syntax that 
> either uses a multi-character delimiter or a user-specified delimiter.  For 
> example, Perl has the sh here syntax:
> 
> <<END
> Any number of
> lines ending with a line containing what follows <<
> END

I like this.



> I think it is inevitable that annotations will be relatively more awkward 
> in the compact syntax.  In the XML syntax, RELAX NG and annotations are 
> syntactic equals: they are both equally painful/verbose.  However, in the 
> compact syntax, RELAX NG is syntactically privileged -- it has a syntax 
> designed specifically for RELAX NG -- whereas annotations are using a 
> generic syntax.  The most user-friendly compact syntax for something like 
> RelaxNGCC would be achieved not by using annotations but by designing a 
> special purpose extension to the compact syntax.  For example, ideally with 
> RelaxNGCC I shouldn't have to quote Java at all: the syntax would know 
> about the lexical conventions of Java.

In fact that's where RelaxNGCC is heading. We are testing a syntax that
mixes characters into RELAX NG:

    <define name="Block" cc:with-params="boolean additional, String data"
        cc:return-type="MyBlockAST">
        
        <element name="foo">
            child = <ref name="anotherPattern"/>(params);
            do.some.work.on(child);
        </element>
    </define>


I suppose the compact syntax version of that can be much more like
JavaCC:

    MyBlockAST Block(boolean additional,String data) {}
    {
        element foo {
            child=anotherPattern(params)
            {
                do.some.work.on(child);
            }
        }
    }



I don't know if pursuing this kind of special syntax for RelaxNGCC is a
good idea, though. The syntax is harder to learn and the code looks like
JavaCC so much but the generated code are way different (one block will
become one function in JavaCC, whereas it will become one class in
RelaxNGCC.)


regards,
--
Kohsuke KAWAGUCHI
Sun Microsystems                   kohsuke.kawaguchi@sun.com



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


Powered by eList eXpress LLC