/[svn]/cduce/trunk/tests/biblio.cd
ViewVC logotype

Contents of /cduce/trunk/tests/biblio.cd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1956 - (hide annotations)
Wed Jul 11 13:01:15 2007 UTC (5 years, 11 months ago) by abate
File size: 2484 byte(s)
new svn layout

1 abate 55 type Biblio = <bibliography>[Heading Paper*];;
2 abate 66 type Heading = <heading>[ PCDATA ];;
3 abate 137 type Paper = <paper>[Author+ Title ((Conference Series?) |(Journal Volume? Number)) Publisher? Year File Abstract?];;
4 abate 66 type Author = <author>[ PCDATA ];;
5     type Title = <title>[ PCDATA ];;
6     type Conference = <conference>[ PCDATA ];;
7 abate 137 type Series = <series>[ PCDATA ];;
8     type Journal = <journal>[ PCDATA ];;
9     type Publisher = <publisher>[ PCDATA ];;
10     type Volume = <volume>[ Int ];;
11     type Number = <number>[ Int ];;
12     type Year = <year>[ 1970--2010 ];;
13 abate 66 type File = <file>[ PCDATA ];;
14 abate 137 type Abstract= <abstract> Text;;
15     type Text = [ PCDATA ];;
16 abate 55
17 abate 137
18 abate 55 type Html = <html>[Head? Body];;
19 abate 66 type Head = <head>[ <title>[ PCDATA ] ];;
20 abate 55 type Body = <body>[Mix*];;
21     type Mix = <h1>[Mix*]
22 abate 66 | <a href=String>[Mix*]
23 abate 55 | <p>[Mix*]
24     | <em>[Mix*]
25     | <ul>[ <li>[Mix*] +]
26     | Char;;
27    
28     let fun do_authors ([Author+] -> [Mix*])
29     | [ <author>a ] -> a
30 abate 110 | [ <author>a <author>b ] -> a @ " and, " @ b
31     | [ <author>a; x] -> a @ ", " @ (do_authors x);;
32 abate 91
33 abate 55 let fun do_paper (Paper -> <li>[Mix*])
34 abate 1746 | <paper>[ x::_* <title>t <_>c _* <year>_ <file>f _* ] ->
35 abate 55 (* Here, type inference says: x : [Author+] ... *)
36     let authors = do_authors x in
37 abate 110 <li>([ <a href=f>t ] @ authors @ "; in " @ [ <em>c ] @ "." );;
38 abate 91
39 abate 137
40 abate 55 let fun do_biblio (Biblio -> Html)
41     <bibliography>[ <heading>h; p ] ->
42 abate 1424 let body = match p with
43 abate 55 | [] -> "Empty bibliography"
44     | l -> [ <h1>h <ul>(map l with x -> do_paper x) ]
45 abate 1424 in
46 abate 91 <html>[ <head>[ <title>h ] <body>body ];;
47    
48 abate 89 let bib : Biblio =
49 abate 55 <bibliography>[
50     <heading>"Alain Frisch's bibliography"
51     <paper>[
52     <author>"Alain Frisch"
53 abate 1424 (* <author>"Giuseppe Castagna"
54     <author>"Véronique Benzaken" *)
55 abate 55 <title>"Semantic subtyping"
56     <conference>"LICS 02"
57 abate 137 <year>[2002]
58 abate 55 <file>"semsub.ps.gz"
59 abate 1424 <abstract>[ 'In this work,...' ]
60 abate 55 ]
61 abate 1424 (*
62 abate 55 <paper>[
63     <author>"Mariangiola Dezani-Ciancaglini"
64     <author>"Alain Frisch"
65     <author>"Elio Giovannetti"
66     <author>"Yoko Motohama"
67     <title>"The Relevance of Semantic Subtyping"
68     <conference>"ITRS'02"
69 abate 137 <year>[2002]
70 abate 55 <file>"itrs02.ps.gz"
71     ]
72     <paper>[
73     <author>"Véronique Benzaken"
74     <author>"Giuseppe Castagna"
75     <author>"Alain Frisch"
76     <title>"CDuce: a white-paper"
77     <conference>"PLANX-02"
78 abate 137 <year>[2002]
79 abate 55 <file>"planx.ps.gz"
80     ]
81 abate 1424 *)
82 abate 91 ];;
83    
84 abate 55 do_biblio bib
85     ;;
86 abate 151
87 abate 1424 (*
88 abate 151
89 abate 650 [bib]/<papr>_/<author>_;;
90    
91 abate 1424 *)

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5