Commit 8d98e9cd authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2005-07-30 19:49:01 by afrisch] Empty log message

Original author: afrisch
Date: 2005-07-30 19:49:01+00:00
parent b182ca94
......@@ -19,14 +19,6 @@ version of OCaml which integrates CDuce features: expressions, types,
patterns.
</p>
<p>
See the <a
href="http://pauillac.inria.fr/~frisch/ocamlcduce/doc/README.cduce">README.cduce</a>
file for more information, The sub-directory <tt>tests/</tt> has some
simple examples. There is also an ocamldoc-generated documentation
for the <a href="http://pauillac.inria.fr/~frisch/ocamlcduce/doc/">support library</a>.
</p>
</box>
<box title="Download and installation" link="install">
......@@ -869,8 +861,8 @@ type variables are not allowed, the OCaml type must be fully known.
</p>
<p>
The translation for an OCaml type <code>t</code> is by structural
induction on the definition of <code>t</code>. Sum types are
The translation for an OCaml type <code>t</code> is defined by structural
induction on <code>t</code>. Sum types are
translated to union types: a constant constructor <code>A</code> is
translated to the qualified name <code>`A</code>; a non-constant
constructor <code>A of t1 * ... * tn</code> is translated to
......@@ -910,4 +902,99 @@ is <code>{{ON}}{{ [Int*] }}</code>.
</box>
<box title="The standard library" link="stdlib">
<p>
In OCamlDuce, the Num library from OCaml is included in the standard
library. In addition, there are two new module called
<code>Ocamlduce</code> and <code>Cduce_types</code> in the standard library.
</p>
<p>
The module <code>Cduce_types</code> gives access to the internal
representation of x-values. It is currently undocumented.
</p>
<p>
The module <code>Ocamlduce</code> provides several useful
functionality x-values. See the <a href="http://yquem.inria.fr/~frisch/ocamlcduce/doc/ocamlduce/Ocamlduce.html">ocamldoc</a> generated
documentation for a description of its interface.
</p>
</box>
<box title="Code samples" link="code">
<section title="Parsing XML files">
<p>
OCamlDuce does not come with any built-in XML parser. However,
the <a href="http://yquem.inria.fr/~frisch/ocamlcduce/doc/ocamlduce/Ocamlduce.Load.html"><code>Ocamlduce.Load</code></a> module in the standard library
makes it easy to plug existing XML parsers. Here is some
code which demonstrate how to do that with three of
the most popular OCaml XML parser libraries:
</p>
<ul>
<li><a
href="http://yquem.inria.fr/~frisch/ocamlcduce/samples/pxp/">PXP</a></li>
<li><a
href="http://yquem.inria.fr/~frisch/ocamlcduce/samples/expat/">Expat</a></li>
<li><a href="http://yquem.inria.fr/~frisch/ocamlcduce/samples/xmllight/">Xml-light</a></li>
</ul>
</section>
<section title="Converting DTD to OCamlDuce types">
<p>
This <a href="http://yquem.inria.fr/~frisch/ocamlcduce/samples/dtd2types/">tool</a> produces a set of OCamlDuce type declarations
from a DTD. It requires PXP.
</p>
<note>This application does not use any of the new features, but it
can be useful in the development of OCamlDuce applications.
</note>
</section>
<section title="Parsing XML Schema, producing valid XHTML output">
<p>
This <a
href="http://yquem.inria.fr/~frisch/ocamlcduce/samples/schema/">application</a>
parses XML Schema Definitions (.xsd files), and produces summaries
(toplevel declaration names) in XHTML. OCamlDuce type system ensures
that the parser is coherent with the input XML type (any valid XML
Schema is accepted) and that the printer is coherent with the output
XML type (it is necessarily a valid XHTML document).
</p>
<p>
Of course, for such a simple transformation, parsing the XML document
into an internal representation is not necessary. A direct XML-to-XML
transformation would be easy to write. We wanted to illustrate
a complex parsing of XML.
</p>
<p>
It it interesting to introduce errors in the parser
<code>schema_loader.ml</code> or the printer
<code>dump_schema.ml</code> and see how the type system catch them.
</p>
<note>
The application uses XML Light to parse XML document.
</note>
<note>
Some features of XML Schema are not parsed, such as
<code>redefine</code> elements or substitution groups.
</note>
</section>
</box>
</page>
\ No newline at end of file
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