Commit 37130103 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-01-31 10:39:26 by beppe] Empty log message

Original author: beppe
Date: 2004-01-31 10:39:26+00:00
parent 1e03f000
......@@ -25,13 +25,11 @@ test it on the <a href="cgi-bin/cduce">online interpreter</a>.
<p>
CDuce's type system can find very nasty errors. For instance look at this DTD declaration
</p>
<p>
<tt>
&lt;!ELEMENT person (name,children)><br/>
&lt;!ELEMENT children (person+)><br/>
&lt;!ELEMENT name (#PCDATA)><br/>
</tt>
</p>
<xmlsample><![CDATA[
<!ELEMENT person (name,children)>
<!ELEMENT children (person+)>
<!ELEMENT name (#PCDATA)>
]]></xmlsample>
<p>
Apparently this declaration does not pose any problem. But if you consider it more carefully you will see that there exists no document that can be valid for such a DTD,
as a person contains a sequence of children that contain a non empty
......@@ -59,12 +57,11 @@ This definition yields an empty type for Person<br/>
<p>
The type checker correctly issues a "Warning" to signal that the first
two types are empty. Note that instead the declarations</p>
<p>
<tt>
type Person = &lt;person>[ Name Children ]<br/>
type Children = &lt;children>[(<i style="color:red">ref Person</i>)+]<br/>
type Name = &lt;name>[PCDATA]<br/>
</tt></p>
<sample><![CDATA[
type Person = <person>[ Name Children ]
type Children = <children>[(<i style="color:red">ref Person</i>)+]
type Name = <name>[PCDATA]
]]></sample>
<p>
correctly do not yield any warning: in this case it is possible to build a value of type person (and thus of type children), for instance by using a recursive definition where a person is a child of itself.
</p>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment