Re: What is a pragma?

On 29/01/2022 10:05, Norm Tovey-Walsh wrote:
> I thnk what I had in mind was something like the following: if a grammar
> without pragmas recognizes a certain set of sentences, adding pragmas to
> the grammar shouldn’t change the set of sentences it recognizes.

I wonder if Norm has stumbled on something that needs to be emphasised 
more. If I understand correctly, the addition of any pragma will NOT or 
even NEVER, alter the set of sentences any conformant IXML processor 
will recognise against a supplied IXML grammar. But it might:

 1. Alter the generated output from such a recognition, such as element
    renaming, or tree-depth reduction
 2. Give the processor some hint that enables faster parsing, such as
    the 'you can use regular expressions on this non-terminal'.
 3. More ???

The important point is that the IXML processor has two phases:

 1. Recognising that the input sentence corresponds to the grammar
    described by the supplied IXML declaration and generating a parse
    tree, and
 2. Generating an output XML structure from that parse tree described by
    the 'output' declarations within the supplied IXML grammar declaration.

and that pragmas NEVER alter the parsing 'semantics' of the first phase 
(albeit perhaps the issue of 'prefix parsing' might be a grey area.)

Probably wrong, but if not, I think worth making the distinction.

-- 
*John Lumley* MA PhD CEng FIEE
john@saxonica.com
on behalf of Saxonica Ltd

Received on Saturday, 29 January 2022 10:57:05 UTC