Commit 2c6bee57 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-01-31 13:11:54 by beppe] Empty log message

Original author: beppe
Date: 2004-01-31 13:11:54+00:00
parent 6e7a3b1e
......@@ -68,6 +68,22 @@ div.abstract {
background: #F0F0F0;
}
div.note {
text-align: justify;
font: bold helvetica;
margin: 1ex 3em 1ex 3em;
padding: 1ex 1em 1ex 1em;
background: #D0E2D2;
}
div.session
{
font: bold 80% helvetica;
margin: 1ex 1em 1ex 1em;
padding: 1ex 1em 1ex 1em;
border: solid .5px grey;
}
div.abstract p {
font: 100% sans-serif;
}
......@@ -105,6 +121,13 @@ div.code {
padding: 0.2ex;
}
div.xmlcode {
background: #ebefa2;
margin: 0.5ex 0.5em 0 0.5em;
padding: 0.2ex;
}
div.title {
background: #FFFFFF;
border: solid 2px #000000;
......
......@@ -40,6 +40,7 @@ type Content =
| <section title=String>Content
| <sample highlight=?"true"|"false">String
| <xmlsample highlight=?"true"|"false">String
| <sessionsample highlight=?"true"|"false">String
| H:Xtable
| Paper | Slides | Link
| <boxes-toc sections=?"">[] (* the presence optional "section" attr produces *)
......@@ -72,9 +73,11 @@ let load_include (String -> [Any*])
(* Highlighting text between {{...}} *)
let highlight (String -> [ (Char | H:Xvar | H:Xi)* ] )
let highlight (String -> [ (Char | H:Xstrong | H:Xi)* ] )
| [ '{{%%' h ::(Char *?) '%%}}' ; rest ] ->
[ <strong class="highlight">[<i>h]; highlight rest ]
| [ '{{' h ::(Char *?) '}}' ; rest ] ->
[ <var class="highlight">h; highlight rest ]
[ <strong class="highlight">h; highlight rest ]
| [ '%%' h ::(Char *?) '%%' ; rest ] ->
[ <i>h; highlight rest ]
| [ c; rest ] -> [ c; highlight rest ]
......@@ -179,8 +182,7 @@ p {
pre {
margin: 1ex 1em 0 1em;
}
var.highlight {
font: roman;
strong.highlight {
color: #FF0000;
}
img.icon {
......@@ -214,6 +216,14 @@ div.note {
}
div.session
{
font: bold 80% helvetica;
margin: 1ex 1em 1ex 1em;
padding: 1ex 1em 1ex 1em;
border: solid .5px grey;
}
div.abstract p {
font: sans-serif;
}
......@@ -274,6 +284,10 @@ match page with
[ <div class="xmlcode">[ <pre>s ] ]
| <xmlsample>s ->
[ <div class="xmlcode">[ <pre>(highlight s) ] ]
| <sessionsample highlight="false">s ->
[ <div class="session">[ <pre>s ] ]
| <sessionsample>s ->
[ <div class="session">[ <pre>(highlight s) ] ]
| <link url=url title=title>com ->
[ <a href=url>title '. ' !(text com) ]
| <ul>lis ->
......
......@@ -16,7 +16,16 @@ test it on the <a href="cgi-bin/cduce">online interpreter</a>.
<box title="Key concepts" link="p1">
<b style="color:#FF0080">TO BE DONE</b>
<p>
CDuce, statically detects a large class of error and tries to help their
debbugging by providing precise error messages and, in case of type errors, by
showing a description (we call it a "sample") of specific values that would make
the computation fail.
</p>
<b style="color:#FF0080">TO BE FINISHED (show example of unused type variable as a typo in a type name) show example of samples</b>
</box>
......@@ -39,27 +48,24 @@ sequence of persons, etc generating an infinite tree.
<p>
Let us write the same type in CDuce and look at the result returned by the type-checker (taken verbatim from the on line demo, no color or formatting added)
</p>
<p>
<tt>
type Person = &lt;person>[ Name Children ]<br/>
type Children = &lt;children>[Person+]<br/>
type Name = &lt;name>[PCDATA]
<br/>
<br/>
Warning at chars 57-76:<br/>
<i>type Children = <b style="color:red">&lt;children&gt;[Person+]</b></i><br/>
This definition yields an empty type for Children <br/>
Warning at chars 14-39:<br/>
<i>type Person = <b style="color:red">&lt;person&gt;[ Name Children ]</b></i><br/>
This definition yields an empty type for Person<br/>
</tt>
</p>
<sessionsample><![CDATA[
type Person = <person>[ Name Children ]
type Children = <children>[Person+]
type Name = <name>[PCDATA]
Warning at chars 57-76:
%%type Children = %%{{%%<children>[Person+]%%}}
This definition yields an empty type for Children
Warning at chars 14-39:
%%type Person = %%{{%%<person>[ Name Children ]%%}}
This definition yields an empty type for Person
]]></sessionsample>
<p>
The type checker correctly issues a "Warning" to signal that the first
two types are empty. Note that instead the declarations</p>
<sample><![CDATA[
type Person = <person>[ Name Children ]
type Children = <children>[(<i style="color:red">ref Person</i>)+]
type Children = <children>[({{ref Person}})+]
type Name = <name>[PCDATA]
]]></sample>
<p>
......@@ -99,21 +105,18 @@ emails never printed. The CDuce type-checker however recognizes that this branch
has no chance to be selected since <code> Person &amp; &lt;_>[_ _
&lt;emal>s]</code>=<code>Empty</code> and it warns the programmer by issuing the following warning message:
</p>
<p>
<tt>
Warning at chars 144-167:<br/>
<i> | <b style="color:red">&lt;_&gt;[_ _ &lt;emal&gt;s] -&gt; [s]</b></i><br/>
This branch is not used<br/>
<i>fun main_contacts(x : [Person*]):[String*] =<br/>
&#160;&#160;transform x with <br/>
&#160;&#160;&#160;&#160;&#160;| &lt;_&gt;[_ _ &lt;emal&gt;s] -&gt; [s]<br/>
&#160;&#160;&#160;&#160;&#160;| &lt;_&gt;[_ &lt;tel&gt;s ] -&gt; [s]</i>
<br/>
- : [ Person* ] -&gt; [ String* ] = &lt;fun&gt;<br/>
<br/>
<sessionsample><![CDATA[
Warning at chars 144-167:
%% | %%{{%%<_>[_ _ <emal>;s] -> [s]%%}}
This branch is not used
%%fun main_contacts(x : [Person*]):[String*] =
transform x with
| <_>[_ _ <emal>s] -> [s]
| <_>[_ <tel>s ] -> [s]%%
- : [ Person* ] -> [ String* ] = <fun>
Ok.
</tt>
</p>
]]></sessionsample>
</box>
</page>
\ No newline at end of file
......@@ -83,7 +83,7 @@ where <code>%%p%%</code> is a pattern and <code>%%e%%</code>,
A small aside about the examples in this tutorial and their usage. The
first program that prints "Hello word" can be tried directly on the on-line
prototype: just select and copy it, click on the link to the on-line
interpreter in the side bar, paste it in the execution window and run it. The
interpreter in the side bar (we suggest you open it in a new window), paste it in the execution window and run it. The
second example instead cannot be run. This is visually signaled by the fact
that it contains text in italics. We use italics for meta notation, so
<code>%%e%%</code> and <code>%%e'%%</code> stand for generic expression, so it is useless to run
......
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