Thread View: comp.text.sgml
2 messages
2 total messages
Started by MATZEN RICHARD WAL
Sat, 26 Sep 1992 03:32
Re: More questions on ambiguity
Author: MATZEN RICHARD WAL
Date: Sat, 26 Sep 1992 03:32
Date: Sat, 26 Sep 1992 03:32
66 lines
3629 bytes
3629 bytes
Erik Naggum <SGML@ifi.uio.no> writes: | I think the clue here is the definition of "exception" (and, by | reference, "inclusion" and "exclusion": | 4.130 exceptions: A parameter of an element declaration that | modifies the effect of the element's "content model" <126>, and the | content models of elements occurring within it, by permitting | inclusions and prohibiting exclusions. | 4.131 exclusions: Elements that are not allowed anywhere in the | content of an element or its subelements been though the application | content model or inclusions would permit them optionally. | 4.157 inclusions: Elements that are allowed anywhere in the content | of an element or its subelements even though the applicable model | does not permit them. | An inclusion cannot, by definition, affect the content model in which it | occurs, because it allows elements not allowed by the content model, and | in the event of a potential clash, the model group in the content model | takes precedence. I concur that the above definitions imply that inclusions cannot affect definition 11.2.4.3 directly. That is, inclusions cannot satisfy primitive content tokens. However, I believe that 11.2.5.1 confuses the issue (lines 14-21) and this should be cleared up in the definitions. Regarding exclusions and their affect on ambiguous content models: What about <!ELEMENT B (X | A | X) >. This is an ambiguous content model. But if "X" is excluded from B is it still ambiguous? By 11.2.4.3, to be ambiguous there must be an element that occurs in an instance of B, that can satisfy more than one primitive content token (X, in this example). But, by definition 4.131 (above), X is not allowed anywhere in the content of B. Doesn't this mean that X cannot occur in an instance of B, and thus, the content model is not ambiguous when X is excluded? Even if I am missing something, and the example above is not a valid argument that exclusions can affect the ambiguity of content models, I I believe that the definition of "ambiguous content models" is still misleading because: 1. inclusions are a component of content models, and... 2. a kind of ambiguity can be introduced by inclusions: between inclusions and primitive content tokens. Resolving ambiguity by disambiguating rules while parsing the document instance, is not the same as not being ambiguous. If the definition of ambiguous content models applies only to model groups then why not restate it as such? Thus, removing any possible confusion to implementors and users about what it covers (and what it does not). I appreciated Eric's response and learned from it. More comments from any and all will be appreciated. Anne Brueggemann-Klein has sent me a copy of her paper on "Unambiguity of SGML Content Models". I am also working on a paper on ambiguity. I would like to hear more on this issue. Is there a concensus in the SGML community regarding the equivalence of ambiguous content models and ambiguous model groups? Does anyone feel that the definition is misleading or causes other problems? Regards, Rick Matzen Oklahoma State University Stillwater OK 74074 <matzen@a.cs.okstate.edu>
Re: More questions on ambiguity
Author: Erik Naggum
Date: Sat, 26 Sep 1992 22:39
Date: Sat, 26 Sep 1992 22:39
129 lines
7028 bytes
7028 bytes
MATZEN RICHARD WAL <matzen@a.cs.okstate.edu> writes:
|
| I concur that the above definitions imply that inclusions cannot affect
| definition 11.2.4.3 directly. That is, inclusions cannot satisfy
| primitive content tokens.
... because inclusions _aren't_ primitive content tokens, but a set of
allowed elements which apply if the primitive content tokens would
otherwise not include them. This is splitting hairs, though.
| However, I believe that 11.2.5.1 confuses the issue (lines 14-21)
| and this should be cleared up in the definitions.
A minor point on vocabulary. "Definition" applies to individual terms,
as defined in clause 4, while "11.2.4.3" is a "clause" (or sub-sub-sub-
clause) and contains "requirements", not definitions. I'm thus not sure
whether the last word should be "definitions" or "requirements". (Also,
I assume that "lines 14-21" refer to Goldfarb [418:14-21], but regard
this only as a request for unambiguous references.)
Assuming that you mean "requirements", I'm inclined to agree with you.
11.2.5.1 can be hard to grasp, because of the approach to describe by
example, rather than in principles or abstract rules. Now, the idea is
clear: An inclusion means that any number of elements with generic
identifiers from the set of applicable inclusions is always valid
before, between, and after any (complete) elements specified by the
content model. Within the content of each such element, the same rule
applies to its content model, recursively.
| Regarding exclusions and their affect on ambiguous content models:
|
| What about <!ELEMENT B (X | A | X) >. This is an ambiguous content
| model. But if "X" is excluded from B is it still ambiguous? By
| 11.2.4.3, to be ambiguous there must be an element that occurs in an
| instance of B, that can satisfy more than one primitive content
| token (X, in this example).
Remember that "the priority rules stated earlier in 11.2.4 are not
considered in determinging whether a content model is unambiguous"
[415:3]. It's precisely these rules that specify what it takes to
conform to the content model. The exclusions are only used to forbid
elements, rather than actually modify the content model to remove them.
Likewise, inclusions only allow elements with generic identifiers from
the set of applicable inclusions, before, between, and after the model
group tokens in the content model.
| But, by definition 4.131 (above), X is not allowed anywhere in the
| content of B. Doesn't this mean that X cannot occur in an
| instance of B, and thus, the content model is not ambiguous when X is
| excluded?
Yes, if the exclusions are known at the time the content model is
checked for ambiguity. No, if the exclusion of X is inherited from a
superior element as it occurs in the document instance. I would favor
an interpretation which didn't differentiate between inherited
exclusions and those that are declared with the content model, and thus
it would be reasonable to consider (un)ambiguity without consideration
of exceptions at all.
| Even if I am missing something, and the example above is not a valid
| argument that exclusions can affect the ambiguity of content models,
| I believe that the definition of "ambiguous content models" is still
| misleading because:
|
| 1. inclusions are a component of content models, and...
Yes, as they apply to the content model of the element in which they are
declared. No, because they apply to content models of elements which
are allowed in that element's content. The latter makes it very hard to
analyze a content model for (un)ambiguity without full knowledge of the
rest of the declarations with which it occurs. This is an intractable
position.
| 2. a kind of ambiguity can be introduced by inclusions: between
| inclusions and primitive content tokens. Resolving ambiguity by
| disambiguating rules while parsing the document instance, is not the
| same as not being ambiguous.
The "order of priority" in [412:14-24] is clearly intended to make
inclusions a third-rank citizen, and it applies only if an element can't
satisfy a content token in the content model. I don't see this as an
ambiguity, really.
If you're missing something, I think it's only that exceptions are
inherited by sub-elements, and that it is, in general, impossible to
know what exceptions are in effect until the element occurs in the
document instance, thus thwarting a priori analyses.
| If the definition of ambiguous content models applies only to model
| groups then why not restate it as such? Thus, removing any possible
| confusion to implementors and users about what it covers (and what
| it does not).
Hmmm. I think the text already does, with the back-reference to 11.2.4
in 11.2.4.3, although at the first n readings, I thought it only applied
to repetitions of a given token. (Which would render a content model
like (A+, A) unambiguous, but impossible.) It could be made even more
explicit, by stating that
Regardless of exceptions, a "content model" [126] cannot be
ambiguous...
| I appreciated Eric's response and learned from it. More comments
| from any and all will be appreciated. Anne Brueggemann-Klein has
| sent me a copy of her paper on "Unambiguity of SGML Content Models".
| I am also working on a paper on ambiguity. I would like to hear
| more on this issue. Is there a concensus in the SGML community
| regarding the equivalence of ambiguous content models and ambiguous
| model groups? Does anyone feel that the definition is misleading or
| causes other problems?
I think Brueggemann-Klein's work did away with the problems, and I
strongly support her assumption that ambiguity is a characteristic of
the content model model group, only. Further, I see no need to consider
exceptions, primarily because they complicate the matter so much, even
when you do know them all, which you generally don't.
This discussion has clarified the handling of exceptions for me, and I
can make my code much more elegant. (Plus, I discovered a bug in my
parser which complained if an element was allowed by a superior content
model, but excluded from the current element's content.)
Best regards,
</Erik>
--
Erik Naggum | ISO 8879 SGML | +47 295 0313
| ISO 10744 HyTime |
<erik@naggum.no> | ISO 10646 UCS | Memento, terrigena.
<enag@ifi.uio.no> | ISO 9899 C | Memento, vita brevis.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads