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>. ...@@ -25,13 +25,11 @@ test it on the <a href="cgi-bin/cduce">online interpreter</a>.
<p> <p>
CDuce's type system can find very nasty errors. For instance look at this DTD declaration CDuce's type system can find very nasty errors. For instance look at this DTD declaration
</p> </p>
<p> <xmlsample><![CDATA[
<tt> <!ELEMENT person (name,children)>
&lt;!ELEMENT person (name,children)><br/> <!ELEMENT children (person+)>
&lt;!ELEMENT children (person+)><br/> <!ELEMENT name (#PCDATA)>
&lt;!ELEMENT name (#PCDATA)><br/> ]]></xmlsample>
</tt>
</p>
<p> <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, 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 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/> ...@@ -59,12 +57,11 @@ This definition yields an empty type for Person<br/>
<p> <p>
The type checker correctly issues a "Warning" to signal that the first The type checker correctly issues a "Warning" to signal that the first
two types are empty. Note that instead the declarations</p> two types are empty. Note that instead the declarations</p>
<p> <sample><![CDATA[
<tt> type Person = <person>[ Name Children ]
type Person = &lt;person>[ Name Children ]<br/> type Children = <children>[(<i style="color:red">ref Person</i>)+]
type Children = &lt;children>[(<i style="color:red">ref Person</i>)+]<br/> type Name = <name>[PCDATA]
type Name = &lt;name>[PCDATA]<br/> ]]></sample>
</tt></p>
<p> <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. 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> </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