Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
f5d5c3c1
Commit
f5d5c3c1
authored
Jul 10, 2007
by
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
Changes
13
Hide whitespace changes
Inline
Side-by-side
web/bench.xml
View file @
f5d5c3c1
<?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>
web/cduce.css
View file @
f5d5c3c1
...
...
@@ -43,7 +43,7 @@ p {
pre
{
margin
:
1ex
1em
0
1em
;
}
var
.hilight
{
var
.hi
gh
light
{
color
:
#FF0000
;
}
...
...
web/examples.xml
View file @
f5d5c3c1
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page
output
=
"examples
.php
"
>
<page
name
=
"examples"
>
<title>
C
Duce: c
ode examples
</title>
<banner>
C
Duce: c
ode 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>
web/index.xml
View file @
f5d5c3c1
<?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>
web/memento.xml
View file @
f5d5c3c1
<?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:
<
duc
e>
0,1,2,3,...
</
duc
e>
</li>
<li>
Types: intervals
<
duc
e>
-*--10, 20--30, 50--*, ...
</
duc
e>
,
singletons
<
duc
e>
0,1,2,3,...
</
duc
e>
</li>
<li>
Operators:
<
duc
e>
+,-,/,*,div,mod, int_of
</
duc
e>
</li>
<li>
Values:
<
cod
e>
0,1,2,3,...
</
cod
e>
</li>
<li>
Types: intervals
<
cod
e>
-*--10, 20--30, 50--*, ...
</
cod
e>
,
singletons
<
cod
e>
0,1,2,3,...
</
cod
e>
</li>
<li>
Operators:
<
cod
e>
+,-,/,*,div,mod, int_of
</
cod
e>
</li>
</ul>
</li>
<li>
Unicode characters:
<ul>
<li>
Values:
<
duc
e>
'a','b','c'...
</
duc
e>
</li>
<li>
Types: intervals
<
duc
e>
'a'--'z', '0'--'9'
</
duc
e>
,
singletons
<
duc
e>
'a','b','c',...
</
duc
e>
</li>
<li>
Values:
<
cod
e>
'a','b','c'...
</
cod
e>
</li>
<li>
Types: intervals
<
cod
e>
'a'--'z', '0'--'9'
</
cod
e>
,
singletons
<
cod
e>
'a','b','c',...
</
cod
e>
</li>
</ul>
</li>
<li>
Symbolic atoms:
<ul>
<li>
Values:
<
duc
e>
`A, `B, `a, `b, `true, `false, ...
</
duc
e>
</li>
<li>
Types: singletons
<
duc
e>
`A, `B, ...
</
duc
e>
</li>
<li>
Operators:
<
duc
e>
atom_of
</
duc
e>
: String -> Atom
</li>
<li>
Values:
<
cod
e>
`A, `B, `a, `b, `true, `false, ...
</
cod
e>
</li>
<li>
Types: singletons
<
cod
e>
`A, `B, ...
</
cod
e>
</li>
<li>
Operators:
<
cod
e>
atom_of
</
cod
e>
: 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/>
<
duc
e>
@
</
duc
e>
: String,String -> String
<br/>
<
duc
e>
+,*,-,div,mod
</
duc
e>
: Integer,Integer -> Integer
<br/>
<
duc
e>
=,
<<
,
<
=,
>>
,
>
=
</
duc
e>
:
Integer,Integer -> Bool =
<
duc
e>
`true | `false
</
duc
e>
<br/>
<
cod
e>
@
</
cod
e>
: String,String -> String
<br/>
<
cod
e>
+,*,-,div,mod
</
cod
e>
: Integer,Integer -> Integer
<br/>
<
cod
e>
=,
<<
,
<
=,
>>
,
>
=
</
cod
e>
:
Integer,Integer -> Bool =
<
cod
e>
`true | `false
</
cod
e>
</li>
<li>
Prefix:
<br/><
duc
e>
load_xml,load_html
</
duc
e>
: String -> Any,
<br/><
duc
e>
dump_to_file
</
duc
e>
: String -> String -> Any,
<br/><
duc
e>
print_xml
</
duc
e>
: Any -> String
<br/><
duc
e>
print
</
duc
e>
: String -> []
<br/><
duc
e>
int_of
</
duc
e>
: [('0'--'9')+] -> Integer
<br/><
duc
e>
string_of
</
duc
e>
: Integer -> String
<br/><
cod
e>
load_xml,load_html
</
cod
e>
: String -> Any,
<br/><
cod
e>
dump_to_file
</
cod
e>
: String -> String -> Any,
<br/><
cod
e>
print_xml
</
cod
e>
: Any -> String
<br/><
cod
e>
print
</
cod
e>
: String -> []
<br/><
cod
e>
int_of
</
cod
e>
: [('0'--'9')+] -> Integer
<br/><
cod
e>
string_of
</
cod
e>
: Integer -> String
</li>
<li>
Postfix:
<br/><
duc
e>
?,*,+,??,*?,+?
</
duc
e>
: for regexp
<br/><
cod
e>
?,*,+,??,*?,+?
</
cod
e>
: for regexp
</li>
</ul>
</box>
<box
title=
"Pairs"
link=
"pair"
>
<ul>
<li>
Expressions:
<
duc
e>
(e1,e2)
</
duc
e>
</li>
<li>
Types and patterns:
<
duc
e>
(t1,t2)
</
duc
e>
</li>
<li>
Expressions:
<
cod
e>
(e1,e2)
</
cod
e>
</li>
<li>
Types and patterns:
<
cod
e>
(t1,t2)
</
cod
e>
</li>
<li>
Note: tuples are right-associative pairs; e.g.:
<
duc
e>
(1,2,3)=(1,(2,3))
</
duc
e>
</li>
<
cod
e>
(1,2,3)=(1,(2,3))
</
cod
e>
</li>
<li>
When a capture variable appears on both side of a pair pattern,
the two captured values are paired
together (e.g.
<
duc
e>
match (1,2,3) with (x,(_,x)) -> x ==>
(1,3)
</
duc
e>
).
</li>
together (e.g.
<
cod
e>
match (1,2,3) with (x,(_,x)) -> x ==>
(1,3)
</
cod
e>
).
</li>
</ul>
</box>
<box
title=
"Sequences"
link=
"seq"
>
<ul>
<li>
Expressions:
<
duc
e>
[ 1 2 3 ]
</
duc
e>
,
which is syntactic sugar for
<
duc
e>
(1,(2,(3,`nil)))
</
duc
e>
</li>
<li>
A sub-sequence can be escaped by !:
<
duc
e>
[ 1 2 ![ 3 4 ] 5
]
</
duc
e>
is then equal to
<
duc
e>
[ 1 2 3 4 5 ]
</
duc
e>
.
</li>
<li>
Types and patterns :
<
duc
e>
[ R ]
</
duc
e>
where
<
duc
e>
R
</
duc
e>
is
<li>
Expressions:
<
cod
e>
[ 1 2 3 ]
</
cod
e>
,
which is syntactic sugar for
<
cod
e>
(1,(2,(3,`nil)))
</
cod
e>
</li>
<li>
A sub-sequence can be escaped by !:
<
cod
e>
[ 1 2 ![ 3 4 ] 5
]
</
cod
e>
is then equal to
<
cod
e>
[ 1 2 3 4 5 ]
</
cod
e>
.
</li>
<li>
Types and patterns :
<
cod
e>
[ R ]
</
cod
e>
where
<
cod
e>
R
</
cod
e>
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:
<
duc
e>
*,+,?
</
duc
e>
and the ungreedy variants (for patterns)
<
duc
e>
*?, +?
,??
</
duc
e></li>
<li>
Postfix repetition operators:
<
cod
e>
*,+,?
</
cod
e>
and the ungreedy variants (for patterns)
<
cod
e>
*?, +?
,??
</
cod
e></li>
<li>
Concatenation of regexps
</li>
<li>
For patterns, sequence capture variable
<
duc
e>
x::R
</
duc
e>
</li>
<li>
For patterns, sequence capture variable
<
cod
e>
x::R
</
cod
e>
</li>
</ul>
</li>
<li>
It is possible to specify a tail, for expressions, types, and patterns;
e.g.:
<
duc
e>
[ x::Int*; q ]
</
duc
e>
</li>
<li>
Map:
<
duc
e>
map e with p1 -> e1 | ... | pn -> en
</
duc
e>
.
e.g.:
<
cod
e>
[ x::Int*; q ]
</
cod
e>
</li>
<li>
Map:
<
cod
e>
map e with p1 -> e1 | ... | pn -> en
</
cod
e>
.
Each element of e must be matched.
</li>
<li>
Transform:
<
duc
e>
transform e with p1 -> e1 | ... | pn -> en
</
duc
e>
.
<li>
Transform:
<
cod
e>
transform e with p1 -> e1 | ... | pn -> en
</
cod
e>
.
Unmatched elements are discarded; each branch returns a sequence
and all the resulting sequences are concatenated together.
</li>
<li>
Operators: concatenation
<
duc
e>
e1 @ e2 = [ !e1 !e2 ]
</
duc
e>
,
flattening
<
duc
e>
flatten e = transform e with x -> x
</
duc
e>
.
<li>
Operators: concatenation
<
cod
e>
e1 @ e2 = [ !e1 !e2 ]
</
cod
e>
,
flattening
<
cod
e>
flatten e = transform e with x -> x
</
cod
e>
.
</li>
</ul>
</box>
<box
title=
"Record"
link=
"record"
>
<ul>
<li>
Records litteral
<
duc
e>
{ l1 = e1; ...; ln = en }
</
duc
e></li>
<li>
Types:
<
duc
e>
{| l1 = t1; ...; ln = tn |}
</
duc
e>
(closed, no more
fields allowed),
<
duc
e>
>{ l1 = t1; ...; ln = tn }
</
duc
e>
(open,
any other field allowed). Optional fields:
<
duc
e>
li =? ti
</
duc
e>
instead of
<
duc
e>
li = ti
</
duc
e>
.
</li>
<li>
Record concatenation:
<
duc
e>
e1 + e2
</
duc
e>
<li>
Records litteral
<
cod
e>
{ l1 = e1; ...; ln = en }
</
cod
e></li>
<li>
Types:
<
cod
e>
{| l1 = t1; ...; ln = tn |}
</
cod
e>
(closed, no more
fields allowed),
<
cod
e>
>{ l1 = t1; ...; ln = tn }
</
cod
e>
(open,
any other field allowed). Optional fields:
<
cod
e>
li =? ti
</
cod
e>
instead of
<
cod
e>
li = ti
</
cod
e>
.
</li>
<li>
Record concatenation:
<
cod
e>
e1 + e2
</
cod
e>
(priority to the fields from the right argument)
</li>
<li>
Field removal:
<
duc
e>
e1 \ l
</
duc
e>
(does nothing if the
field
<
duc
e>
l
</
duc
e>
is not present)
</li>
<li>
Field access:
<
duc
e>
e1 . l
</
duc
e></li>
<li>
Record:
<
duc
e>
{ l1 = p1; ...; ln = pn }
</
duc
e></li>
<li>
Field removal:
<
cod
e>
e1 \ l
</
cod
e>
(does nothing if the
field
<
cod
e>
l
</
cod
e>
is not present)
</li>
<li>
Field access:
<
cod
e>
e1 . l
</
cod
e></li>
<li>
Record:
<
cod
e>
{ l1 = p1; ...; ln = pn }
</
cod
e></li>
</ul>
</box>
<box
title=
"Strings"
link=
"string"
>
<ul>
<li>
Strings are actually sequences of characters.
</li>
<li>
Expressions:
<
duc
e>
"abc", [ 'abc' ], [ 'a' 'b' 'c' ]
</
duc
e>
.
</li>
<li>
Operators:
<
duc
e>
string_of, print, dump_to_file
</
duc
e></li>
<li><
duc
e>
PCDATA
</
duc
e>
means
<
duc
e>
Char*
</
duc
e>
inside regular expressions
</li>
<li>
Expressions:
<
cod
e>
"abc", [ 'abc' ], [ 'a' 'b' 'c' ]
</
cod
e>
.
</li>
<li>
Operators:
<
cod
e>
string_of, print, dump_to_file
</
cod
e></li>
<li><
cod
e>
PCDATA
</
cod
e>
means
<
cod
e>
Char*
</
cod
e>
inside regular expressions
</li>
</ul>
</box>
<box
title=
"XML elements"
link=
"xml"
>
<ul>
<li>
Expressions:
<
duc
e>
<
(tag) (attr)>content
</
duc
e>
</li>
<li>
If the tag is an atom
<
duc
e>
`X
</
duc
e>
, it can be written
<
duc
e>
X
</
duc
e>
(without the
<
duc
e>
(..)
</
duc
e>
).
<li>
Expressions:
<
cod
e>
<
(tag) (attr)>content
</
cod
e>
</li>
<li>
If the tag is an atom
<
cod
e>
`X
</
cod
e>
, it can be written
<
cod
e>
X
</
cod
e>
(without the
<
cod
e>
(..)
</
cod
e>
).
Similarly, parenthesis and curly braces may be omitted
when attr is a record
<
duc
e>
l1=e1;...;ln=en
</
duc
e>
.
E.g:
<
duc
e>
<
a href="abc">[ 'abc' ]
</
duc
e>
.
</li>
when attr is a record
<
cod
e>
l1=e1;...;ln=en
</
cod
e>
.
E.g:
<
cod
e>
<
a href="abc">[ 'abc' ]
</
cod
e>
.
</li>
<li>
Types and patterns: same notations.
</li>
<li>
Operators:
<
duc
e>
load_xml : String -> Any; print_xml : Any -> String
</
duc
e>
<li>
Operators:
<
cod
e>
load_xml : String -> Any; print_xml : Any -> String
</
cod
e>
</li>
</ul>
</box>
...
...
@@ -169,71 +157,61 @@ field <duce>l</duce> is not present)</li>
<ul>
<li>
Expressions:
<ul>
<li>
General form:
<
duc
e>
fun f (t1->s1;...;tn->sn)
p1 -> e1 | ... | pn -> en
</
duc
e>
(
<
duc
e>
f
</
duc
e>
is optional)
</li>
<li>
Simple function:
<
duc
e>
fun f (p : t) : s = e
</
duc
e>
,
equivalent to
<
duc
e>
fun f (t -> s) p -> e
</
duc
e>
</li>
<li>
Multiple arguments:
<
duc
e>
fun f (p1 : t1, p2 : t2,...) : s =
e
</
duc
e>
, equivalent to
<
duc
e>
fun f ((p1,p2,...):(t1,t2,...)) : s
= e
</
duc
e>
</li>
<li>
General form:
<
cod
e>
fun f (t1->s1;...;tn->sn)
p1 -> e1 | ... | pn -> en
</
cod
e>
(
<
cod
e>
f
</
cod
e>
is optional)
</li>
<li>
Simple function:
<
cod
e>
fun f (p : t) : s = e
</
cod
e>
,
equivalent to
<
cod
e>
fun f (t -> s) p -> e
</
cod
e>
</li>
<li>
Multiple arguments:
<
cod
e>
fun f (p1 : t1, p2 : t2,...) : s =
e
</
cod
e>
, equivalent to
<
cod
e>
fun f ((p1,p2,...):(t1,t2,...)) : s
= e
</
cod
e>
</li>
</ul>
</li>
<li>
Types:
<
duc
e>
t -> s
</
duc
e>
</li>
<li>
Types:
<
cod
e>
t -> s
</
cod
e>
</li>
</ul>
</box>
<box
title=
"Pattern matching, exceptions, ..."
link=
"match"
>
<ul>
<li>
Type restriction:
<
duc
e>
(e : t)
</
duc
e>
(forgets any more precise
type for
<
duc
e>
e
</
duc
e>
)
</li>
<li>
Pattern matching:
<
duc
e>
match e with p1 -> e1 | ... | pn ->
en
</
duc
e></li>
<li>
Local binding:
<
duc
e>
let p = e1 in e2
</
duc
e>
, equivalent to
<
duc
e>
match e1 with p -> e2
</
duc
e>
;
<
duc
e>
let p : t = e1 in e2
</
duc
e>
equivalent to
<
duc
e>
let p = (e1 : t) in e2
</
duc
e>
</li>
<li>
If-then-else:
<
duc
e>
if e1 then e2 else e3
</
duc
e>
, equivalent to
<
duc
e>
match e1 with `true -> e2 | `false -> e3
</
duc
e></li>
<li>
Type restriction:
<
cod
e>
(e : t)
</
cod
e>
(forgets any more precise
type for
<
cod
e>
e
</
cod
e>
)
</li>
<li>
Pattern matching:
<
cod
e>
match e with p1 -> e1 | ... | pn ->
en
</
cod
e></li>
<li>
Local binding:
<
cod
e>
let p = e1 in e2
</
cod
e>
, equivalent to
<
cod
e>
match e1 with p -> e2
</
cod
e>
;
<
cod
e>
let p : t = e1 in e2
</
cod
e>
equivalent to
<
cod
e>
let p = (e1 : t) in e2
</
cod
e>
</li>
<li>
If-then-else:
<
cod
e>
if e1 then e2 else e3
</
cod
e>
, equivalent to
<
cod
e>
match e1 with `true -> e2 | `false -> e3
</
cod
e></li>
<li>
Exceptions:
<ul>
<li>
Raise exception:
<
duc
e>
raise e
</
duc
e></li>
<li>
Handle exception:
<
duc
e>
try e with p1 -> e1 | ... | pn ->
en
</
duc
e></li>
<li>
Raise exception:
<
cod
e>
raise e
</
cod
e></li>
<li>
Handle exception:
<
cod
e>
try e with p1 -> e1 | ... | pn ->
en
</
cod
e></li>
</ul>
</li>
</ul>
</box>
<box
title=
"More about types and patterns"
link=
"type"
>
<ul>
<li>
Boolean connectives:
<
duc
e>
&
,|,\
</
duc
e>
(
<
duc
e>
|
</
duc
e>
is
<li>
Boolean connectives:
<
cod
e>
&
,|,\
</
cod
e>
(
<
cod
e>
|
</
cod
e>
is
first-match).
</li>
<li>
Empty and universal types:
<
duc
e>
Empty,Any
</
duc
e>
or
<
duc
e>
_
</
duc
e>
.
</li>
<li>
Recursive types and patterns:
<
duc
e>
t where T1 = t2 and ... and
Tn = tn
</
duc
e>
.
</li>
<li>
Capture variable:
<
duc
e>
x
</
duc
e>
.
</li>
<li>
Default values:
<
duc
e>
(x := c)
</
duc
e>
.
</li>
<li>
Empty and universal types:
<
cod
e>
Empty,Any
</
cod
e>
or
<
cod
e>
_
</
cod
e>
.
</li>
<li>
Recursive types and patterns:
<
cod
e>
t where T1 = t2 and ... and
Tn = tn
</
cod
e>
.
</li>
<li>
Capture variable:
<
cod
e>
x
</
cod
e>
.
</li>
<li>
Default values:
<
cod
e>
(x := c)
</
cod
e>
.
</li>
</ul>
</box>
<box
title=
"Toplevel statements"
link=
"t
ype
"
>
<box
title=
"Toplevel statements"
link=
"t
oplevel
"
>
<ul>
<li>
Type declarations:
<
duc
e>
type T = t
</
duc
e>
.
</li>
<li>
Source inclusion:
<
duc
e>
include
</
duc
e>
<i>
filename_string
</i></li>
<li>
Debug directives:
<
duc
e>
debug
</
duc
e>
<i>
directive argument
</i>
<br/>
where
<i>
directive
</i>
is one of the following:
<
duc
e>
accept
</
duc
e>
,
<
duc
e>
subtype
</
duc
e>
,
<
duc
e>
compile
</
duc
e>
.
<li>
Type declarations:
<
cod
e>
type T = t
</
cod
e>
.
</li>
<li>
Source inclusion:
<
cod
e>
include
</
cod
e>
<i>
filename_string
</i></li>
<li>
Debug directives:
<
cod
e>
debug
</
cod
e>
<i>
directive argument
</i>
<br/>
where
<i>
directive
</i>
is one of the following:
<
cod
e>
accept
</
cod
e>
,
<
cod
e>
subtype
</
cod
e>
,
<
cod
e>
compile
</
cod
e>
.
</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>
web/papers.xml
View file @
f5d5c3c1
<?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>
web/site.cd
View file @
f5d5c3c1
...
...
@@ -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;;