Project x.ml: Modeling XML in ML
Objective Caml code for technical report TR-IIS-03-007
of the Institute. (Part of the report is also submitted
to a conference for presentation.)
File 213.ml contains
the complete Objective Caml code for the example
in Section 8.
Code for my ICFP 2001 paper
Here is some Objective Caml code that maps the
DTD of WML (WAP Markup Language) to module expressions.
The module expressions are constructed inductively,
and the functions for validating WML elements are
derived in a generic way. There are four files.
- util.ml -- some common utility functions,
- a36.ml -- a set of higher-order modules for building
element content models,
- wap.ml -- express WML DTD using modules
from file a36.ml,
- wap_test.ml -- a small test program.
They can be compiled and executed by the following commands
(assuming Objective Caml has been installed):
- ocamlc -c util.ml
- ocamlc -c a36.ml
- ocamlc -c wap.ml
- ocamlc -c wap_test.ml
- ocamlc util.cmo a36.cmo wap.cmo wap_test.cmo
- a.out
The following string should appears on the screen.
forget o validate = id
validate o forget = id
Comments and questions are most welcome.
Please send e-mail to:
t r c @ i i s . s i n i c a . e d u . t w