apply2Test.ml 41.8 KB
Newer Older
Pietro Abate's avatar
Pietro Abate committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
(* This type has been automatically generated from ../tests/xhtml1-strict.dtd by dtd2cduce *)
open TypesOUnit;;
open Types;;

let parse_typ s =
  let st = Stream.of_string s in
  let astpat = Parser.pat st in
  let nodepat = Typer.typ Builtin.env astpat in
  Types.descr nodepat
;;

let html =   "<html xmlns=\"http://www.w3.org/1999/xhtml\" id=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String>[
          (head body) ]
where
 td =
       <td valign=?(\"top\" | \"middle\" | \"bottom\" | \"baseline\") charoff=?String char=?String align=?(\"left\" | \"center\" | \"right\" | \"justify\" | \"char\") colspan=?String rowspan=?String scope=?(\"row\" | \"col\" | \"rowgroup\" | \"colgroup\") headers=?String axis=?String abbr=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | noscript | ins | del | script )*
          ]
and  th =
       <th valign=?(\"top\" | \"middle\" | \"bottom\" | \"baseline\") charoff=?String char=?String align=?(\"left\" | \"center\" | \"right\" | \"justify\" | \"char\") colspan=?String rowspan=?String scope=?(\"row\" | \"col\" | \"rowgroup\" | \"colgroup\") headers=?String axis=?String abbr=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | noscript | ins | del | script )*
          ]
and  tr =
       <tr valign=?(\"top\" | \"middle\" | \"bottom\" | \"baseline\") charoff=?String char=?String align=?(\"left\" | \"center\" | \"right\" | \"justify\" | \"char\") onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          (th | td)+ ]
and  col =
       <col valign=?(\"top\" | \"middle\" | \"bottom\" | \"baseline\") charoff=?String char=?String align=?(\"left\" | \"center\" | \"right\" | \"justify\" | \"char\") width=?String span=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
           ]
and  colgroup =
       <colgroup valign=?(\"top\" | \"middle\" | \"bottom\" | \"baseline\") charoff=?String char=?String align=?(\"left\" | \"center\" | \"right\" | \"justify\" | \"char\") width=?String span=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          col* ]
and  tbody =
       <tbody valign=?(\"top\" | \"middle\" | \"bottom\" | \"baseline\") charoff=?String char=?String align=?(\"left\" | \"center\" | \"right\" | \"justify\" | \"char\") onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          tr+ ]
and  tfoot =
       <tfoot valign=?(\"top\" | \"middle\" | \"bottom\" | \"baseline\") charoff=?String char=?String align=?(\"left\" | \"center\" | \"right\" | \"justify\" | \"char\") onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          tr+ ]
and  thead =
       <thead valign=?(\"top\" | \"middle\" | \"bottom\" | \"baseline\") charoff=?String char=?String align=?(\"left\" | \"center\" | \"right\" | \"justify\" | \"char\") onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          tr+ ]
and  caption =
       <caption onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  table =
       <table cellpadding=?String cellspacing=?String rules=?(\"none\" | \"groups\" | \"rows\" | \"cols\" | \"all\") frame=?(\"void\" | \"above\" | \"below\" | \"hsides\" | \"lhs\" | \"rhs\" | \"vsides\" | \"box\" | \"border\") border=?String width=?String summary=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          (caption? (col* | colgroup*) thead? tfoot? (tbody+ | tr+)) ]
and  button =
       <button disabled=?(\"disabled\") type=?(\"button\" | \"submit\" | \"reset\") value=?String name=?String onblur=?String onfocus=?String tabindex=?String accesskey=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | table | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | noscript | ins | del | script )*
          ]
and  legend =
       <legend accesskey=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  fieldset =
       <fieldset onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | legend | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | noscript | ins | del | script )*
          ]
and  textarea =
       <textarea onchange=?String onselect=?String readonly=?(\"readonly\") disabled=?(\"disabled\") cols=String rows=String name=?String onblur=?String onfocus=?String tabindex=?String accesskey=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char )* ]
and  option =
       <option value=?String label=?String disabled=?(\"disabled\") selected=?(\"selected\") onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char )* ]
and  optgroup =
       <optgroup label=String disabled=?(\"disabled\") onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          option+ ]
and  select =
       <select onchange=?String onblur=?String onfocus=?String tabindex=?String disabled=?(\"disabled\") multiple=?(\"multiple\") size=?String name=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          (optgroup | option)+ ]
and  input =
       <input accept=?String onchange=?String onselect=?String usemap=?String alt=?String src=?String maxlength=?String size=?String readonly=?(\"readonly\") disabled=?(\"disabled\") checked=?(\"checked\") value=?String name=?String type=?(\"text\" | \"password\" | \"checkbox\" | \"radio\" | \"submit\" | \"reset\" | \"file\" | \"hidden\" | \"image\" | \"button\") onblur=?String onfocus=?String tabindex=?String accesskey=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
           ]
and  label =
       <label onblur=?String onfocus=?String accesskey=?String for=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  form =
       <form accept-charset=?String accept=?String onreset=?String onsubmit=?String enctype=?String method=?(\"get\" | \"post\") action=String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          (p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr
           | blockquote | address | fieldset | table | noscript | ins | del
           | script)*
          ]
and  area =
       <area alt=String nohref=?(\"nohref\") href=?String coords=?String shape=?(\"rect\" | \"circle\" | \"poly\" | \"default\") onblur=?String onfocus=?String tabindex=?String accesskey=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
           ]
and  map =
       <map name=?String title=?String style=?String class=?String id=String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String>[
          ((p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr
            | blockquote | address | fieldset | table | form | noscript | ins
            | del | script)+
           | area+)
          ]
and  img =
       <img ismap=?(\"ismap\") usemap=?String width=?String height=?String longdesc=?String alt=String src=String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
           ]
and  param =
       <param type=?String valuetype=?(\"data\" | \"ref\" | \"object\") value=?String name=?String id=?String>[
           ]
and  object =
       <object tabindex=?String name=?String usemap=?String width=?String height=?String standby=?String archive=?String codetype=?String type=?String data=?String codebase=?String classid=?String declare=?(\"declare\") onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | param | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | noscript | ins | del | script )*
          ]
and  small =
       <small onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  big =
       <big onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  b =
       <b onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  i =
       <i onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  tt =
       <tt onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  sup =
       <sup onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  sub =
       <sub onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  q =
       <q cite=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  acronym =
       <acronym onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  abbr =
       <abbr onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  cite =
       <cite onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  var =
       <var onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  kbd =
       <kbd onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  samp =
       <samp onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  code =
       <code onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  dfn =
       <dfn onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  strong =
       <strong onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  em =
       <em onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  br = <br title=?String style=?String class=?String id=?String>[  ]
and  bdo =
       <bdo dir=(\"ltr\" | \"rtl\") xml:lang=?String lang=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  span =
       <span onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  a =
       <a coords=?String shape=?(\"rect\" | \"circle\" | \"poly\" | \"default\") rev=?String rel=?String hreflang=?String href=?String name=?String type=?String charset=?String onblur=?String onfocus=?String tabindex=?String accesskey=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  del =
       <del datetime=?String cite=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | noscript | ins | del | script )*
          ]
and  ins =
       <ins datetime=?String cite=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | noscript | ins | del | script )*
          ]
and  blockquote =
       <blockquote cite=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          (p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr
           | blockquote | address | fieldset | table | form | noscript | ins
           | del | script)*
          ]
and  pre =
       <pre onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | br | span | bdo | map | ins | del | script | input | select | textarea | label | button )*
          ]
and  hr =
       <hr onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
           ]
and  address =
       <address onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  dd =
       <dd onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | noscript | ins | del | script )*
          ]
and  dt =
       <dt onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  dl =
       <dl onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          (dt | dd)+ ]
and  li =
       <li onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | noscript | ins | del | script )*
          ]
and  ol =
       <ol onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          li+ ]
and  ul =
       <ul onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          li+ ]
and  h6 =
       <h6 onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  h5 =
       <h5 onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  h4 =
       <h4 onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  h3 =
       <h3 onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  h2 =
       <h2 onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  h1 =
       <h1 onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  p =
       <p onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | ins | del | script )*
          ]
and  div =
       <div onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          ( Char | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | a | br | span | bdo | map | object | img | tt | i | b | big | small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | noscript | ins | del | script )*
          ]
and  body =
       <body onunload=?String onload=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          (p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr
           | blockquote | address | fieldset | table | form | noscript | ins
           | del | script)*
          ]
and  noscript =
       <noscript onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
          (p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr
           | blockquote | address | fieldset | table | form | noscript | ins
           | del | script)*
          ]
and  script =
       <script defer=?(\"defer\") src=?String type=String charset=?String id=?String>[
          ( Char )* ]
and  style =
       <style title=?String media=?String type=String id=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String>[
          ( Char )* ]
and  link =
       <link media=?String rev=?String rel=?String type=?String hreflang=?String href=?String charset=?String onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String title=?String style=?String class=?String id=?String>[
           ]
and  meta =
       <meta scheme=?String content=String name=?String http-equiv=?String id=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String>[
           ]
and  base = <base id=?String href=String>[  ]
and  title =
       <title id=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String>[
          ( Char )* ]
and  head =
       <head profile=?String id=?String dir=?(\"ltr\" | \"rtl\") xml:lang=?String lang=?String>[
          ((script | style | meta | link | object)*
           ((title (script | style | meta | link | object)*
             (base (script | style | meta | link | object)*)?)
            | (base (script | style | meta | link | object)*
               (title (script | style | meta | link | object)*))))
          ]"
;;

let html = "<page filename=Latin1>[ <title>String; Content ] where
Content = [ (Box | Section)* ] 

and Box = <box>Text
and Section = <section no=?Int>[ <title>String ; Text ]

and Text = [ (Char | <duce>String | <ul>[<li>Text +] 
	      | <a href=String>String | <br>[])* ]
";;

let html = "<html>[ Head Body ] where
Flow = Char | Block | Inline | Misc
and Block = P | Heading | Div | Lists | Table | Blocktext
and Lists = Ul
and Blocktext = Pre | Hr | Blockquote | Address
and Inline = Char | A | Special | Fontstyle | Phrase
and Fontstyle = Tt | I | B | Big | Small
and Phrase = Em | Strong | Code
and Special = Br
and Misc = Empty

and Head = <head>[ Title ]
and Title = <title>[ PCDATA ]
and Body = <body bgcolor=String>[ Block* ]

and Div = <div>[ Flow* ]
and P = <p>[ Inline* ]
and Heading = <(`h1 | `h2)>[ Inline* ]

and Ul = <ul>[Li+]
and Li = <li>[ Flow* ]

and Address = <address>[ Inline* ]
and Hr = <hr>[]
and Pre = <pre>[ (PCDATA | A | Fontstyle | Phrase | Br)* ]
and Blockquote = <blockquote>[ Block* ]

and A = <a ({ name = String } | { href = String })>[ (Inline \ A)* ]
and Br = <br>[]
and Em = <em>[ Inline* ]
and Code = <code>[ Inline* ]
and Strong = <strong>[ Inline* ]
and Tt = <tt>[ Inline* ]
and I = <i>[ Inline* ]
and B = <b>[ Inline* ]
and Big = <big>[ Inline* ]
and Small = <small>[ Inline* ]

and Table = <table border=?String; bgcolor=String; width=String>
     [ <tr>[ <td>[ Flow* ]+ ]+ ]
"

let html_to_bool = Printf.sprintf "(%s) -> Bool" html;;
let t1 = parse_typ html_to_bool
let t2 = parse_typ html
let () = Printf.eprintf "Here\n%!";;

Types.apply t1 t2
;;