The SGML and XML standards use a variation of regular expressions called content models for modeling the markup structures of document elements. SGML content models may include so called and groups, which are excluded from XML. An and group, which is a sequence of subexpressions separated by an &-operator, denotes the sequential catenation of its subexpressions in any possible order. If one wants to shift from SGML to XML in document production, one has to translate SGML content models to corresponding XML content models. The allowed content models in both SGML and XML are restricted by a requirement of determinism, which means that a parser recognizing document element contents has to be able to decide without lookahead, which content model token to match with the current input token, while processing the document from left to right. It is known that not all SGML content models can be expressed as an equivalent XML content model. It is also known that transforming an SGML content model into an equivalent XML content model may cause an exponential growth in the length of the content model. We discuss methods of eliminating and groups and analyze the circumstances where they can be applied. We derive a tight bound of en! on the number of symbols in the result of eliminating an and group of n symbols, where e = 2:71828 : : : is the base of natural logarithms. We present the analysis in a pedagogical manner, emphasizing mathematical methods which are typical to the analysis of algorithms. We also show that minimal deterministic automata for recognizing an and group of n distinct element names contain 2 n states and n2 n?1 transitions, excluding the failure state and transitions leading to it.
[1]
Derick Wood,et al.
Theory of computation
,
1986
.
[2]
Alfred V. Aho,et al.
The Theory of Parsing, Translation, and Compiling
,
1972
.
[3]
Derick Wood,et al.
One-Unambiguous Regular Languages
,
1998,
Inf. Comput..
[4]
Ronald L. Graham,et al.
Concrete mathematics - a foundation for computer science
,
1991
.
[5]
Derick Wood,et al.
The validation of SGML content models
,
1997
.
[6]
Bell Telephone,et al.
Regular Expression Search Algorithm
,
1968
.
[7]
Anne Brüggemann-Klein,et al.
Unambiguity of Extended Regular Expressions in SGML Document Grammars
,
1993,
ESA.
[8]
Charles F. Goldfarb,et al.
SGML handbook
,
1990
.
[9]
Anne Brüggemann-Klein,et al.
Regular Expressions into Finite Automata
,
1992,
Theor. Comput. Sci..
[10]
Anne Br Uggemann-Klein.
Compiler-construction Tools and Techniques for Sgml Parsers: Diiculties and Solutions
,
1994
.
[11]
R. K. Shyamasundar,et al.
Introduction to algorithms
,
1996
.
[12]
Alfred V. Aho,et al.
Compilers: Principles, Techniques, and Tools
,
1986,
Addison-Wesley series in computer science / World student series edition.