Re: What is a pragma?

Sorry I'm so late to the party: I had forgotten that I have an XML/XSLT course starting this week, and had to spend a little extra time this weekend preparing.

I've been asked for my $0.02 on what I believe a pragma is, so I shall attempt to do so here; I note, however, that everything I have to contribute has very likely already been stated.

I do not come from a formal background in either linguistics or computer science: my training was in Physics, and my career in XML has come through publishing, so I do not feel qualified to pass comment on what Pragma mean, or how they are defined, generally.  Neither do I feel beholden to another language's definition/use of pragma, except in the hope that the term will be meaningful to prospective users.

Specifically in the context of iXML and in my own mind, what we have been calling pragma exist in order to mark up grammars with extra information that processors can optionally use to inform options or operations in addition to or instead of the standard, conformant behaviour.

A processor therefore needs not only to recognise a pragma, but also whether or not it is a pragma which represents some instruction it "understands" and may choose to act upon.  So pragma need some form of ID, label, or name in addition to any other data that forms the instruction.

Any conforming grammar is conformant whether or not the pragma in that grammar would result in some non-conformant parse: all pragma must be ignorable, resulting in fall-back behaviour equivalent to the grammar with ignored pragmas stripped out.  Stripping out all pragma by definition must leave a conformant grammar.

However, I don't think we should rush into making statements about the conformance of a pragma itself: if they exist to extend the spec, they exist to do so in ways we can not and should not attempt to predict.

I like the idea that adding pragma should not change the set of input sentences a grammar may parse; however, if we can't realistically restrict the functionality of pragmas (I like Michael's "your foot" argument, gun control opinions aside!), if pragma exist to allow users to provide extension functions, I don't see how this is enforceable, nor that it belongs as an imperative part of the specification.

What I think is totally reasonable to add to the spec is a mechanism for explicitly allowing and disallowing given sets of pragma, so that undesirable or broken pragmas can be excluded from any parser foolish enough to have implemented them.  But perhaps we should finish adding pragma, first!

_________________
Tomos Hillman
eXpertML Ltd
+44 7793 242058
On 30 Jan 2022, 16:37 +0000, C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>, wrote:
>
> I think it might be cleaner and simpler to say that the standard
> semantics of the grammar is as defined in the spec, that the semantics
> of a pragma are implementation-defined, and that the presence or absence
> of pragmas has, by definition, no effect on the standard semantics of
> the grammar.
>
> If people want to add that implementations SHOULD refrain from defining
> pragmas which change the set of input sentences accepted by a grammar, I
> think I would urge them to think again, but I don't currently think I
> would lie down in the road over it. A MUST would bother me more,
> though, because it makes what looks like a potentially very tricky
> question into a conformance criterion.
>

Received on Monday, 31 January 2022 22:30:09 UTC