Re: Pragmas

To return to a point that's been raised in previous discussions, if we have broad agreement on the definition of pragmas I've outlined, perhaps I could now work on putting together a set of requirements for pragmas in iXML? We can then look at any proposals in terms of a consensus on what we're aiming to achieve.

BTW

___________________________________________________ 
Dr. Bethan Tovey-Walsh 

linguacelta.com <http://linguacelta.com/> 

Golygydd | Editor geirfan.cymru <https://geirfan.cymru/>

 <https://geirfan.cymru/>Croeso i chi ysgrifennu ataf yn y Gymraeg.

> On 7 Jan 2025, at 13:53, Norm Tovey-Walsh <norm@saxonica.com> wrote:
> 
> Steven Pemberton <steven.pemberton@cwi.nl> writes:
>> To try and put pragmas to bed, I'd like to propose a Processing Instruction style of solution.
> 
> I don’t think that’s sufficient. One of the key differences between iXML and XML is that the XML serialization of XML is, uh, explicit. The XML serialization of iXML is determined by the parse.
> 
> The strategy you describe doesn’t satisfy the requirement that I’ve articulated repeatedly that it must be possible to associate a pragma with a rule or a terminal or an nonterminal. Consider this grammar:
> 
> S = A .
> {c1}
> A = {c2} a, {c3} "b", c {c4} .
> a = "a" .
> c = "c" .
> 
> The XML serialization of that grammar leaves the comments scattered about in unhelpful ways:
> 
> <ixml>
>   <rule name='S'>
>      <alt>
>         <nonterminal name='A'/>
>      </alt>
>   </rule>
>   <comment>c1</comment>
>   <rule name='A'>
>      <comment>c2</comment>
>      <alt>
>         <nonterminal name='a'/>
>         <comment>c3</comment>
>         <literal string='b'/>
>         <nonterminal name='c'>
>            <comment>c4</comment>
>         </nonterminal>
>      </alt>
>   </rule>
>   <rule name='a'>
>      <alt>
>         <literal string='a'/>
>      </alt>
>   </rule>
>   <rule name='c'>
>      <alt>
>         <literal string='c'/>
>      </alt>
>   </rule>
> </ixml>
> 
> Using the grammar of the pragmas proposal from Balisage, we get much better association of pragmas with elements in the XML. This grammar:
> 
> S = A .
> {[p1]}
> A = {[p2]} a, {[p3]} "b", c {[p4]} .
> a = "a" .
> c = "c" .
> 
> serializes into this XML:
> 
> <ixml>
>   <rule name='S'>
>      <alt>
>         <nonterminal name='A'/>
>      </alt>
>   </rule>
>   <rule name='A'>
>      <pragma pname='p1'/>
>      <alt>
>         <nonterminal name='a'>
>            <pragma pname='p2'/>
>         </nonterminal>
>         <literal string='b'>
>            <pragma pname='p3'/>
>         </literal>
>         <nonterminal name='c'/>
>      </alt>
>      <pragma pname='p4'/>
>   </rule>
>   <rule name='a'>
>      <alt>
>         <literal string='a'/>
>      </alt>
>   </rule>
>   <rule name='c'>
>      <alt>
>         <literal string='c'/>
>      </alt>
>   </rule>
> </ixml>
> 
>                                        Be seeing you,
>                                          norm
> 
> --
> Norm Tovey-Walsh
> Saxonica
> 

Received on Tuesday, 7 January 2025 14:58:20 UTC