OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: DTD and Illegal Construct

Wow, it was so good to see Sam Wilmott quoted again,
he is one of our industries real thinkers.

My personal favorite ambiguity puzzle (which I used to
give to SGML DTD-writer classes) goes something like this:
(It's been a while, so pleased forgive any ambiguity;
the wordiness is deliberate obfuscation.)

We need to write a single content model for an element.
That element contains 3 elements: X, Y, and A such that:

  - All X's (if any) must come before all Y's.
  - All X's must clump together. (e.g., X+ or X*)
  - All Y's must similarly clump together.
  - Both the potentially multiple X's and the
    potentially multiple Y's may be followed by
    multiple A's. (That is, if there are any A's,
    they always follow the X's or the Y's.)
  - A's are always optional.
  - Need not have X's or Y's.

The most straight-forward answers are ambiguous,
but listing the cases and solving those will
usually lead to a solution.  (Parser developers
see the solution intuitively, or so they claim.)


(By X's, I mean the plural of "X", sorry.)
Deborah Aleyne Lapeyre               mailto:dalapeyre@mulberrytech.com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9633
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
   Mulberry Technologies: A Consultancy Specializing in SGML and XML