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

[r2003-05-14 16:49:27 by cvscast] Web site is now a tree

Original author: cvscast
Date: 2003-05-14 16:49:33+00:00
parent 3307edb7
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page output="bench.php">
<page name="bench">
<title>Benchmarks</title>
<banner>Benchmarks</banner>
<!-- ********* Left panel ********* -->
<navig>
<toc/>
<box>
<p>
This page briefly presents preliminary benchmarks on the CDuce prototype.
<left>
<p>This page briefly presents preliminary benchmarks on the CDuce
prototype.
</p>
<ul>
<li><a href="/cgi-bin/cduce">Online demo</a></li>
<li><a href="/">Home page</a></li>
</ul>
</box>
</navig>
<!-- ********* Main panel ********* -->
<main>
<boxes-toc/>
<p>See also:</p>
<local-links href="index,proto"/>
</left>
<box title="Methodology" link="meth">
<p>
......@@ -178,6 +168,4 @@ does'nt fit in memory (and swapping occurs).
</box>
</main>
</page>
......@@ -43,7 +43,7 @@ p {
pre {
margin: 1ex 1em 0 1em;
}
var.hilight {
var.highlight {
color: #FF0000;
}
......
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page output="examples.php">
<page name="examples">
<title>CDuce: code examples</title>
<banner>CDuce: code examples</banner>
<title>Code examples</title>
<banner>Code examples</banner>
<!-- ********* Left panel ********* -->
<navig>
<toc/>
<box>
<p>
This page presents some simple CDuce programs.
</p>
<ul>
<li><a href="/cgi-bin/cduce">Online demo</a></li>
<li><a href="/">Home page</a></li>
<li><a href="memento.php">Syntax memento</a></li>
</ul>
</box>
</navig>
<!-- ********* Main panel ********* -->
<main>
<left>
<p>This page presents some simple CDuce programs.</p>
<boxes-toc/>
<p>See also:</p>
<local-links href="index,proto,memento"/>
</left>
<box title="Our canonical example" link="sort">
<sample>
<include-verbatim file="overloading.cd"/>
</sample>
</box>
<box title="The script that generates this site" link="site">
<sample>
<include-verbatim file="site.cd"/>
</sample>
</box>
</main>
</page>
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page output="index.php">
<page name="index">
<title>CDuce</title>
<banner>
......@@ -7,11 +7,23 @@
alt="CDuce"/>
</banner>
<!-- ********* Left panel ********* -->
<navig>
<toc/>
<left>
<p>On this page:</p>
<boxes-toc/>
<p>Under this page:</p>
<pages-toc/>
</left>
<external href="/cgi-bin/cduce" title="Online demo" name="proto"/>
<include file="bench.xml"/>
<include file="memento.xml"/>
<include file="papers.xml"/>
<include file="examples.xml"/>
<include file="team.xml"/>
<include file="tutorial.xml"/>
<include file="sitemap.xml"/>
<!--
<box>
<ul>
<li><a href="plan.php">Site map</a></li>
......@@ -24,8 +36,9 @@
<li><a href="tutorial.php">Tutorial</a></li>
</ul>
</box>
-->
<box>
<left>
<p> CDuce ("seduce") is a new typed functional language with
innovative features.</p>
......@@ -42,23 +55,15 @@ expressed in a system like DTD, or
XML types play a central role in CDuce.
</p>
</box>
</left>
<box>
<left>
<p> All pages of this site were automatically generated from an XML description of
the content by <a href="examples.php#site"> the following CDuce program</a>.
</p><p>
<img src="img/cducepower2.jpg" alt="Powered by CDuce"/></p>
</box>
<toc/>
</navig>
<!-- ********* Main panel ********* -->
</left>
<main>
<box title="What is CDuce ?" link="whatis">
......@@ -85,7 +90,7 @@ few weeks.</p>
</section>
</box>
<box title="Design and features" link="whatis">
<box title="Design and features" link="design">
<p> Our point of view and our guideline for the design of CDuce is
that a programming language for XML should take XML types (
DTD, XML Schema, Relax-NG, ...) seriously. We expect the following
......@@ -240,5 +245,4 @@ title="XML: Some hyperlinks minus the hype"> By Philip Wadler. </link>
</p>
</meta>
</main>
</page>
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page output="memento.php">
<page name="memento">
<title>CDuce memento</title>
<banner> CDuce memento </banner>
<!-- ********* Left panel ********* -->
<navig>
<toc/>
<box>
<p>
This page briefly presents the syntax of the CDuce language.
</p>
<ul>
<li><a href="/cgi-bin/cduce">Online demo</a></li>
<li><a href="/">Home page</a></li>
</ul>
</box>
</navig>
<!-- ********* Main panel ********* -->
<main>
<left>
<p>This page briefly presents the syntax of the CDuce language.</p>
<boxes-toc/>
<p>See also:</p>
<local-links href="index,proto,papers"/>
</left>
<box title="Identifiers" link="id">
<ul>
......@@ -37,24 +25,24 @@ _" character, starting by a capitalized letter or underscore.</li>
<ul>
<li>Large integers:
<ul>
<li>Values: <duce>0,1,2,3,...</duce> </li>
<li>Types: intervals <duce>-*--10, 20--30, 50--*, ...</duce>,
singletons <duce>0,1,2,3,...</duce> </li>
<li>Operators: <duce>+,-,/,*,div,mod, int_of</duce> </li>
<li>Values: <code>0,1,2,3,...</code> </li>
<li>Types: intervals <code>-*--10, 20--30, 50--*, ...</code>,
singletons <code>0,1,2,3,...</code> </li>
<li>Operators: <code>+,-,/,*,div,mod, int_of</code> </li>
</ul>
</li>
<li>Unicode characters:
<ul>
<li>Values: <duce>'a','b','c'...</duce> </li>
<li>Types: intervals <duce>'a'--'z', '0'--'9'</duce>,
singletons <duce>'a','b','c',...</duce> </li>
<li>Values: <code>'a','b','c'...</code> </li>
<li>Types: intervals <code>'a'--'z', '0'--'9'</code>,
singletons <code>'a','b','c',...</code> </li>
</ul>
</li>
<li>Symbolic atoms:
<ul>
<li>Values: <duce>`A, `B, `a, `b, `true, `false, ...</duce> </li>
<li>Types: singletons <duce>`A, `B, ...</duce> </li>
<li>Operators: <duce>atom_of</duce> : String -> Atom</li>
<li>Values: <code>`A, `B, `a, `b, `true, `false, ...</code> </li>
<li>Types: singletons <code>`A, `B, ...</code> </li>
<li>Operators: <code>atom_of</code> : String -> Atom</li>
</ul>
</li>
</ul>
......@@ -63,104 +51,104 @@ _" character, starting by a capitalized letter or underscore.</li>
<box title="Operators" link="op">
<ul>
<li>Infix:
<br/> <duce>@</duce> : String,String -> String
<br/> <duce>+,*,-,div,mod</duce> : Integer,Integer -> Integer
<br/> <duce>=, &lt;&lt;, &lt;=, &gt;&gt;, &gt;= </duce> :
Integer,Integer -> Bool = <duce>`true | `false</duce>
<br/> <code>@</code> : String,String -> String
<br/> <code>+,*,-,div,mod</code> : Integer,Integer -> Integer
<br/> <code>=, &lt;&lt;, &lt;=, &gt;&gt;, &gt;= </code> :
Integer,Integer -> Bool = <code>`true | `false</code>
</li>
<li>Prefix:
<br/><duce>load_xml,load_html</duce> : String -> Any,
<br/><duce>dump_to_file</duce> : String -> String -> Any,
<br/><duce>print_xml</duce> : Any -> String
<br/><duce>print</duce> : String -> []
<br/><duce>int_of</duce> : [('0'--'9')+] -> Integer
<br/><duce>string_of</duce> : Integer -> String
<br/><code>load_xml,load_html</code> : String -> Any,
<br/><code>dump_to_file</code> : String -> String -> Any,
<br/><code>print_xml</code> : Any -> String
<br/><code>print</code> : String -> []
<br/><code>int_of</code> : [('0'--'9')+] -> Integer
<br/><code>string_of</code> : Integer -> String
</li>
<li>Postfix:
<br/><duce>?,*,+,??,*?,+?</duce> : for regexp
<br/><code>?,*,+,??,*?,+?</code> : for regexp
</li>
</ul>
</box>
<box title="Pairs" link="pair">
<ul>
<li>Expressions: <duce>(e1,e2)</duce> </li>
<li>Types and patterns: <duce>(t1,t2)</duce> </li>
<li>Expressions: <code>(e1,e2)</code> </li>
<li>Types and patterns: <code>(t1,t2)</code> </li>
<li>Note: tuples are right-associative pairs; e.g.:
<duce>(1,2,3)=(1,(2,3))</duce> </li>
<code>(1,2,3)=(1,(2,3))</code> </li>
<li>When a capture variable appears on both side of a pair pattern,
the two captured values are paired
together (e.g. <duce>match (1,2,3) with (x,(_,x)) -> x ==>
(1,3)</duce>). </li>
together (e.g. <code>match (1,2,3) with (x,(_,x)) -> x ==>
(1,3)</code>). </li>
</ul>
</box>
<box title="Sequences" link="seq">
<ul>
<li>Expressions: <duce>[ 1 2 3 ]</duce>,
which is syntactic sugar for <duce>(1,(2,(3,`nil)))</duce> </li>
<li>A sub-sequence can be escaped by !: <duce>[ 1 2 ![ 3 4 ] 5
]</duce> is then equal to <duce>[ 1 2 3 4 5 ]</duce> . </li>
<li>Types and patterns : <duce>[ R ]</duce> where <duce>R</duce> is
<li>Expressions: <code>[ 1 2 3 ]</code>,
which is syntactic sugar for <code>(1,(2,(3,`nil)))</code> </li>
<li>A sub-sequence can be escaped by !: <code>[ 1 2 ![ 3 4 ] 5
]</code> is then equal to <code>[ 1 2 3 4 5 ]</code> . </li>
<li>Types and patterns : <code>[ R ]</code> where <code>R</code> is
a regular expression built on types and patterns:
<ul>
<li>A type or a pattern is a regexp by itself, matching a single
element of the sequence </li>
<li>Postfix repetition operators: <duce>*,+,?</duce>
and the ungreedy variants (for patterns) <duce>*?, +?
,??</duce></li>
<li>Postfix repetition operators: <code>*,+,?</code>
and the ungreedy variants (for patterns) <code>*?, +?
,??</code></li>
<li>Concatenation of regexps</li>
<li>For patterns, sequence capture variable <duce>x::R</duce> </li>
<li>For patterns, sequence capture variable <code>x::R</code> </li>
</ul>
</li>
<li>It is possible to specify a tail, for expressions, types, and patterns;
e.g.: <duce>[ x::Int*; q ]</duce> </li>
<li>Map: <duce>map e with p1 -> e1 | ... | pn -> en</duce>.
e.g.: <code>[ x::Int*; q ]</code> </li>
<li>Map: <code>map e with p1 -> e1 | ... | pn -> en</code>.
Each element of e must be matched. </li>
<li>Transform: <duce>transform e with p1 -> e1 | ... | pn -> en</duce>.
<li>Transform: <code>transform e with p1 -> e1 | ... | pn -> en</code>.
Unmatched elements are discarded; each branch returns a sequence
and all the resulting sequences are concatenated together. </li>
<li>Operators: concatenation <duce>e1 @ e2 = [ !e1 !e2 ]</duce>,
flattening <duce>flatten e = transform e with x -> x</duce>.
<li>Operators: concatenation <code>e1 @ e2 = [ !e1 !e2 ]</code>,
flattening <code>flatten e = transform e with x -> x</code>.
</li>
</ul>
</box>
<box title="Record" link="record">
<ul>
<li>Records litteral <duce>{ l1 = e1; ...; ln = en }</duce></li>
<li>Types: <duce>{| l1 = t1; ...; ln = tn |}</duce> (closed, no more
fields allowed), <duce>>{ l1 = t1; ...; ln = tn }</duce> (open,
any other field allowed). Optional fields: <duce>li =? ti</duce>
instead of <duce>li = ti</duce>.</li>
<li>Record concatenation: <duce>e1 + e2</duce>
<li>Records litteral <code>{ l1 = e1; ...; ln = en }</code></li>
<li>Types: <code>{| l1 = t1; ...; ln = tn |}</code> (closed, no more
fields allowed), <code>>{ l1 = t1; ...; ln = tn }</code> (open,
any other field allowed). Optional fields: <code>li =? ti</code>
instead of <code>li = ti</code>.</li>
<li>Record concatenation: <code>e1 + e2</code>
(priority to the fields from the right argument) </li>
<li>Field removal: <duce>e1 \ l</duce> (does nothing if the
field <duce>l</duce> is not present)</li>
<li>Field access: <duce>e1 . l</duce></li>
<li>Record: <duce>{ l1 = p1; ...; ln = pn }</duce></li>
<li>Field removal: <code>e1 \ l</code> (does nothing if the
field <code>l</code> is not present)</li>
<li>Field access: <code>e1 . l</code></li>
<li>Record: <code>{ l1 = p1; ...; ln = pn }</code></li>
</ul>
</box>
<box title="Strings" link="string">
<ul>
<li>Strings are actually sequences of characters.</li>
<li>Expressions: <duce>"abc", [ 'abc' ], [ 'a' 'b' 'c' ]</duce>. </li>
<li>Operators: <duce>string_of, print, dump_to_file</duce></li>
<li><duce>PCDATA</duce> means <duce>Char*</duce> inside regular expressions</li>
<li>Expressions: <code>"abc", [ 'abc' ], [ 'a' 'b' 'c' ]</code>. </li>
<li>Operators: <code>string_of, print, dump_to_file</code></li>
<li><code>PCDATA</code> means <code>Char*</code> inside regular expressions</li>
</ul>
</box>
<box title="XML elements" link="xml">
<ul>
<li>Expressions: <duce> &lt;(tag) (attr)>content</duce> </li>
<li>If the tag is an atom <duce>`X</duce>, it can be written
<duce>X</duce> (without the <duce>(..)</duce>).
<li>Expressions: <code> &lt;(tag) (attr)>content</code> </li>
<li>If the tag is an atom <code>`X</code>, it can be written
<code>X</code> (without the <code>(..)</code>).
Similarly, parenthesis and curly braces may be omitted
when attr is a record <duce>l1=e1;...;ln=en</duce>.
E.g: <duce>&lt;a href="abc">[ 'abc' ]</duce>.</li>
when attr is a record <code>l1=e1;...;ln=en</code>.
E.g: <code>&lt;a href="abc">[ 'abc' ]</code>.</li>
<li>Types and patterns: same notations.</li>
<li>Operators: <duce>load_xml : String -> Any; print_xml : Any -> String</duce>
<li>Operators: <code>load_xml : String -> Any; print_xml : Any -> String</code>
</li>
</ul>
</box>
......@@ -169,71 +157,61 @@ field <duce>l</duce> is not present)</li>
<ul>
<li>Expressions:
<ul>
<li>General form: <duce>fun f (t1->s1;...;tn->sn)
p1 -> e1 | ... | pn -> en</duce> (<duce>f</duce> is optional) </li>
<li>Simple function: <duce>fun f (p : t) : s = e</duce>,
equivalent to <duce>fun f (t -> s) p -> e</duce> </li>
<li>Multiple arguments: <duce>fun f (p1 : t1, p2 : t2,...) : s =
e</duce>, equivalent to <duce>fun f ((p1,p2,...):(t1,t2,...)) : s
= e</duce> </li>
<li>General form: <code>fun f (t1->s1;...;tn->sn)
p1 -> e1 | ... | pn -> en</code> (<code>f</code> is optional) </li>
<li>Simple function: <code>fun f (p : t) : s = e</code>,
equivalent to <code>fun f (t -> s) p -> e</code> </li>
<li>Multiple arguments: <code>fun f (p1 : t1, p2 : t2,...) : s =
e</code>, equivalent to <code>fun f ((p1,p2,...):(t1,t2,...)) : s
= e</code> </li>
</ul>
</li>
<li>Types: <duce>t -> s</duce> </li>
<li>Types: <code>t -> s</code> </li>
</ul>
</box>
<box title="Pattern matching, exceptions, ..." link="match">
<ul>
<li>Type restriction: <duce>(e : t)</duce> (forgets any more precise
type for <duce>e</duce>) </li>
<li>Pattern matching: <duce>match e with p1 -> e1 | ... | pn ->
en</duce></li>
<li>Local binding: <duce>let p = e1 in e2</duce>, equivalent to
<duce>match e1 with p -> e2</duce>;
<duce>let p : t = e1 in e2</duce> equivalent to
<duce>let p = (e1 : t) in e2</duce> </li>
<li>If-then-else: <duce>if e1 then e2 else e3</duce>, equivalent to
<duce>match e1 with `true -> e2 | `false -> e3</duce></li>
<li>Type restriction: <code>(e : t)</code> (forgets any more precise
type for <code>e</code>) </li>
<li>Pattern matching: <code>match e with p1 -> e1 | ... | pn ->
en</code></li>
<li>Local binding: <code>let p = e1 in e2</code>, equivalent to
<code>match e1 with p -> e2</code>;
<code>let p : t = e1 in e2</code> equivalent to
<code>let p = (e1 : t) in e2</code> </li>
<li>If-then-else: <code>if e1 then e2 else e3</code>, equivalent to
<code>match e1 with `true -> e2 | `false -> e3</code></li>
<li>Exceptions: <ul>
<li>Raise exception: <duce>raise e</duce></li>
<li>Handle exception: <duce>try e with p1 -> e1 | ... | pn ->
en</duce></li>
<li>Raise exception: <code>raise e</code></li>
<li>Handle exception: <code>try e with p1 -> e1 | ... | pn ->
en</code></li>
</ul> </li>
</ul>
</box>
<box title="More about types and patterns" link="type">
<ul>
<li>Boolean connectives: <duce>&amp;,|,\</duce> (<duce>|</duce> is
<li>Boolean connectives: <code>&amp;,|,\</code> (<code>|</code> is
first-match). </li>
<li>Empty and universal types: <duce>Empty,Any</duce> or
<duce>_</duce>.</li>
<li>Recursive types and patterns: <duce>t where T1 = t2 and ... and
Tn = tn</duce>.</li>
<li>Capture variable: <duce>x</duce>. </li>
<li>Default values: <duce>(x := c)</duce>. </li>
<li>Empty and universal types: <code>Empty,Any</code> or
<code>_</code>.</li>
<li>Recursive types and patterns: <code>t where T1 = t2 and ... and
Tn = tn</code>.</li>
<li>Capture variable: <code>x</code>. </li>
<li>Default values: <code>(x := c)</code>. </li>
</ul>
</box>
<box title="Toplevel statements" link="type">
<box title="Toplevel statements" link="toplevel">
<ul>
<li>Type declarations: <duce>type T = t</duce>.</li>
<li>Source inclusion: <duce>include </duce> <i> filename_string</i></li>
<li>Debug directives: <duce>debug </duce> <i> directive argument</i> <br/>
where <i> directive</i> is one of the following: <duce>accept</duce>,
<duce>subtype</duce>, <duce>compile</duce>.
<li>Type declarations: <code>type T = t</code>.</li>
<li>Source inclusion: <code>include </code> <i> filename_string</i></li>
<li>Debug directives: <code>debug </code> <i> directive argument</i> <br/>
where <i> directive</i> is one of the following: <code>accept</code>,
<code>subtype</code>, <code>compile</code>.
</li>
</ul>
</box>
<meta>
<p>
This page has been generated by a CDuce program.
</p>
<p><a href="/">Home page</a> - <a href="mailto:Alain.Frisch@ens.fr">Webmaster</a>
</p>
</meta>
</main>
</page>
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page output="papers.php">
<page name="papers">
<title>Papers and talks about CDuce</title>
<title>Papers and talks</title>
<banner>Papers and talks about CDuce</banner>
<!-- ********* Left panel ********* -->
<navig>
<toc/>
<box>
<p>
This page presents Papers and Talks about CDuce.
</p>
<ul>
<li><a href="/cgi-bin/cduce">Online demo</a></li>
<li><a href="/">Home page</a></li>
<li><a href="memento.php">CDuce memento</a></li>
</ul>
</box>
</navig>
<!-- ********* Main panel ********* -->
<main>
<left>
<p>This page presents Papers and Talks about CDuce.</p>
<boxes-toc/>
<p>See also:</p>
<local-links href="index,proto"/>
</left>
<box title="Papers" link="papers">
<section title="Language Description">
......@@ -237,5 +224,4 @@ surcharg
</ul>
</box>
</main>
</page>
......@@ -9,7 +9,8 @@ let fun load_include (String -> [Any*])
name ->
let _ = print [ 'Loading ' !name '... \n' ] in
xtransform [ (load_xml name) ] with
<include file=(s & String)>[] -> load_include s;;
| <include file=(s & String)>[] -> load_include s
| <include-verbatim file=(s & String)>[] -> load_file s;;
let fun highlight (String -> [ (Char | Xvar)* ] )
......@@ -18,17 +19,59 @@ let fun highlight (String -> [ (Char | Xvar)* ] )
| [ c; rest ] -> [ c; highlight rest ]
| [] -> [];;
let fun split_comma (String -> [String*])
| [ x::(Char*?) ',' ; rest ] -> (x, split_comma rest)
| s -> [ s ];;
(* Ugly hack to introduce PHP code ...
The idea is to produce first an XML document with a distinguished element.
The function patch_css search for the textual representation of this
element and replace it with the PHP code. *)
let php_css : String =
[' <?php
$browser = getenv("HTTP_USER_AGENT");
if (preg_match("/MSIE/i", "$browser")) {
$css = "<link rel=\\"stylesheet\\" href=\\"cduce.css\\"
type=\\"text/css\\">";
} elseif (preg_match("/Mozilla/i", "$browser")) {
$css = "<blink>For better presentation use a more recent version
of your browser, like Netscape 6</blink>";
} if (preg_match("/Mozilla\\/5.0/i", "$browser")) {
$css = "<link rel=\\"stylesheet\\" href=\\"cduce.css\\"
type=\\"text/css\\">";
} elseif (preg_match("/opera/i", "$browser")) {
$css = "<link rel=\\"stylesheet\\" href=\\"cduce.css\\"
type=\\"text/css\\">";
}
echo "$css";
?> '];;
let fun patch_css (String -> String)
| [ a::_*? '<meta content="css"/>'; rem ] -> a @ php_css @ rem
| s -> s;;
type SitePage =
Page
| <external {|href=String; title=String|}>[];;
type Site = <site>[ SitePage* ];;
type Page =
<page output=String>[
<page name=String>[
<title>String
<banner>[InlineText*]
<navig>[ NavigBox* ] <main>[ Box* ] ];;
Item*
];;
type External = <external {|href=String; title=String; name=String |}>[];;
type Item =
<box title=String; subtitle=?String; link=String>Content
| <meta>Content
| <left>Content
| Page
| External;;
type Author = <author>String;;