Re: Thoughts on pragmas and iXML

Graydon <graydonish@gmail.com> writes:
> To that end, I would propose:
>
> - pragmas have names, and by analogy with processing instructions,

Yep.

> - when a pragma pertains to a grammar component, at most one pragma of that name pertains to that component. (Again continuing the analogy to processing instructions, we know the name; we do not know anything else.

I think any attempt to limit the semantics of pragmas is out of scope.

> - by default, no pragma is applied when a grammar is processed. A processor must require some positive action to process pragmas.

Maybe, although that seems a bit like a quality of implementation issue to me. There are all sorts of processors and all sorts of ways to use them. We’ve mostly tried to avoid attempting to impose behavior on processors. But only mostly, so it’s not impossible.

> - in the same conceptual way that the sequence constructor in xsl:for-each happens simultaneously for every member of the input sequence, the entire parse tree is constructed before any pragma is applied.

I think iXML wisely says you are free to use any parsing algorithm you wish to implement the parser. I think that’s difficult to square with assertions about how the parser must work.

> I'd like it if a processor had an option to activate pragmas by testing membership in a sequence of pragma names, but I don't think that's anywhere near to being a requirement.

Indeed that’s how my processor works.

As a practical matter, I don’t expect pragmas to appear in most grammars (with the exception, perhaps, of pragmas for metadata (creator, version, date, etc.) if we adopt those, but they have no effect anyway). Of the tiny fraction of grammars that contain any pragmas at all, I expect the overwhelming majority of those will contain only a single pragma.

I’m prepared to “wait and see” a bit on “what if” questions about how an author might manage a grammar with a large number of potentially conflicting pragmas because I don’t actually expect it will ever happen.

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh
Saxonica

Received on Wednesday, 19 February 2025 12:29:58 UTC