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 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- $Id: ast_transi.html,v 6.32 2012-01-09 14:22:20 deraugla Exp $ -->
<!-- Copyright (c) INRIA 2007-2012 -->
<title>AST - transitional</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="styles/base.css"
title="Normal" />
<style type="text/css"><!--
table { margin-left: 1cm }
td { padding-right: 2mm }
--></style>
</head>
<body>
<div id="menu">
</div>
<div id="content">
<h1 class="top">Syntax tree - transitional mode</h1>
<p>This chapter presents the Camlp5 syntax tree when Camlp5 is installed
in <em>transitional</em> mode.</p>
<div id="tableofcontents">
</div>
<h2>Introduction</h2>
<p>This syntax tree is defined in the module "<tt>MLast</tt>" provided
by Camlp5. Each node corresponds to a syntactic entity of the
corresponding type.</p>
<p>For example, the syntax tree of the statement "<tt>if</tt>" can
be written:</p>
<pre>
MLast.ExIfe loc e1 e2 e3
</pre>
<p>where "<tt>loc</tt>" is the location in the source, and
"<tt>e1</tt>", "<tt>e2</tt>" and "<tt>e3</tt>" are
respectively the expression after the "<tt>if</tt>", the one after
the "<tt>then</tt>" and the one after the "<tt>else</tt>".</p>
<p>If a program needs to manipulate syntax trees, it can use the nodes
defined in the module "<tt>MLast</tt>". The programmer must know how
the concrete syntax is transformed into this abstract syntax.</p>
<p>A simpler solution is to use one of the quotation kit
"<tt>q_MLast.cmo</tt>". It
proposes <a href="quot.html">quotations</a> which represent the
abstract syntax (the nodes of the module "<tt>MLast</tt>") into
concrete syntax with antiquotations to bind variables inside. The
example above can be written:</p>
<pre>
<:expr< if $e1$ then $e2$ else $e3$ >>
</pre>
<p>This representation is very interesting when one wants to
manipulate complicated syntax trees. Here is an example taken from
the Camlp5 sources themselves:</p>
<pre>
<:expr<
match try Some $f$ with [ Stream.Failure -> None ] with
[ Some $p$ -> $e$
| _ -> raise (Stream.Error $e2$) ]
>>
</pre>
<p>This example was in a position of a pattern. In abstract syntax, it
should have been written:</p>
<pre>
MLast.ExMat _
(MLast.ExTry _ (MLast.ExApp _ (MLast.ExUid _ "Some") f)
[(MLast.PaAcc _ (MLast.PaUid _ "Stream") (MLast.PaUid _ "Failure"),
None, MLast.ExUid _ "None")])
[(MLast.PaApp _ (MLast.PaUid _ "Some") p, None, e);
(MLast.PaAny _, None,
MLast.ExApp _ (MLast.ExLid _ "raise")
(MLast.ExApp _
(MLast.ExAcc _ (MLast.ExUid _ "Stream") (MLast.ExUid _ "Error"))
e2))]
</pre>
<p>Which is less readable and much more complicated to build and
update.</p>
<p>Instead of thinking of "a syntax tree", the programmer can think of
"a piece of program".</p>
<h2>Location</h2>
<p>In all syntax tree nodes, the first parameter is the source
location of the node.</p>
<h3>In expressions</h3>
<p>When a quotation is in the context of an expression, the location
parameter is "<tt>loc</tt>" in the node and in all its possible
sub-nodes. Example: if we consider the quotation:</p>
<pre>
<:sig_item< value foo : int -> bool >>
</pre>
<p>This quotation, in a context of an expression, is equivalent
to:</p>
<pre>
MLast.SgVal loc "foo"
(MLast.TyArr loc (MLast.TyLid loc "int") (MLast.TyLid loc "bool"));
</pre>
<p>The name "<tt>loc</tt>" is predefined. However, it is possible to
change it, using the argument "<tt>-loc</tt>" of the Camlp5 shell
commands.</p>
<p>Consequently, if there is no variable "<tt>loc</tt>" defined in the
context of the quotation, or if it is not of the correct type, a
semantic error occur in the OCaml compiler ("Unbound value
loc").</p>
<p>Note that in the <a href="grammars.html">extensible grammars</a>,
the variable "<tt>loc</tt>" is bound, in all semantic actions, to
the location of the rule.</p>
<p>If the created node has no location, the programmer can define a
variable named "<tt>loc</tt>" equal to "<tt>Ploc.dummy</tt>".</p>
<h3>In patterns</h3>
<p>When a quotation is in the context of a pattern, the location
parameter of all nodes and possible sub-nodes is set to the wildcard
("<tt>_</tt>"). The same example above:</p>
<pre>
<:sig_item< value foo : int -> bool >>
</pre>
<p>is equivalent, in a pattern, to:</p>
<pre>
MLast.SgVal _ "foo"
(MLast.TyArr _ (MLast.TyLid _ "int") (MLast.TyLid _ "bool"))
</pre>
<p>However, it is possible to generate a binding of the variable
"<tt>loc</tt>" on the top node by writing a "colon" before the
"less" in the quotation. The same example:</p>
<pre>
<:sig_item:< value foo : int -> bool >>
</pre>
<p>is equivalent to:</p>
<pre>
MLast.SgVal loc "foo"
(MLast.TyArr _ (MLast.TyLid _ "int") (MLast.TyLid _ "bool"))
</pre>
<h2>Antiquotations</h2>
<p>The expressions or patterns between dollar ($) characters are
called <em>antiquotations</em>. In opposition to quotations which
has its own syntax rules, the antiquotation is an area in the syntax
of the enclosing context (expression or pattern). See the chapter
about <a href="quot.html">quotations</a>.</p>
<p>If a quotation is in the context of an expression, the
antiquotation must be an expression. It can be any expression,
including function calls. Examples:</p>
<pre>
value f e el = <:expr< [$e$ :: $loop False el$] >>;
value patt_list p pl = <:patt< ( $list:[p::pl]$) >>;
</pre>
<p>If a quotation is in the context of an pattern, the antiquotation
is a pattern. Any pattern is possible, including the wildcard
character ("<tt>_</tt>"). Examples:</p>
<pre>
fun [ <:expr< $lid:op$ $_$ $_$ >> -> op ]
match p with [ <:patt< $_$ | $_$ >> -> Some p ]
</pre>
<h2>Nodes and Quotations</h2>
<p>This section describes all nodes defined in the module "MLast" of
Camlp5 and how to write them with quotations. Notice that, inside
quotations, one is not restricted to these elementary cases, but
any complex value can be used, resulting on possibly complex combined
nodes.</p>
<p>Variables names give information of their types:</p>
<ul>
<li><tt>e</tt>, <tt>e1</tt>, <tt>e2</tt>, <tt>e3</tt>: expr</li>
<li><tt>p</tt>, <tt>p1</tt>, <tt>p2</tt>, <tt>p3</tt>: patt</li>
<li><tt>t</tt>, <tt>t1</tt>, <tt>t2</tt>, <tt>e3</tt>: ctyp</li>
<li><tt>s</tt>: string</li>
<li><tt>b</tt>: bool</li>
<li><tt>me</tt>, <tt>me1</tt>, <tt>me2</tt>: module_expr</li>
<li><tt>mt</tt>, <tt>mt1</tt>, <tt>mt2</tt>: module_type</li>
<li><tt>le</tt>: list expr</li>
<li><tt>lp</tt>: list patt</li>
<li><tt>lt</tt>: list ctyp</li>
<li><tt>ls</tt>: list string</li>
<li><tt>lse</tt>: list (string * expr)</li>
<li><tt>lpe</tt>: list (patt * expr)</li>
<li><tt>lpp</tt>: list (patt * patt)</li>
<li><tt>lpee</tt>: list (patt * option expr * expr)</li>
<li><tt>op</tt>: option patt</li>
<li><tt>lcsi</tt>: list class_str_item</li>
<li><tt>lcsi</tt>: list class_sig_item</li>
</ul>
<h3>expr</h3>
<p>Expressions of the language.</p>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:expr< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>ExAcc loc e1 e2</tt></td>
<td align="center"><tt>$e1$ . $e2$</tt></td>
<td>access</td>
</tr>
<tr>
<td><tt>ExAnt loc e</tt></td>
<td align="center"><tt>$anti:e$</tt></td>
<td>antiquotation <a href="#expr_1">(1)</a></td>
</tr>
<tr>
<td><tt>ExApp loc e1 e2</tt></td>
<td align="center"><tt>$e1$ $e2$</tt></td>
<td>application</td>
</tr>
<tr>
<td><tt>ExAre loc e1 e2</tt></td>
<td align="center"><tt>$e1$ .( $e2$ )</tt></td>
<td>array element</td>
</tr>
<tr>
<td><tt>ExArr loc le</tt></td>
<td align="center"><tt>[| $list:le$ |]</tt></td>
<td>array</td>
</tr>
<tr>
<td><tt>ExAsr loc e</tt></td>
<td align="center"><tt>assert $e$</tt></td>
<td>assert</td>
</tr>
<tr>
<td><tt>ExAss loc e1 e2</tt></td>
<td align="center"><tt>$e1$ := $e2$</tt></td>
<td>assignment</td>
</tr>
<tr>
<td><tt>ExBae loc e le</tt></td>
<td align="center"><tt>$e$ .{ $list:le$ }</tt></td>
<td>big array element</td>
</tr>
<tr>
<td><tt>ExChr loc s</tt></td>
<td align="center"><tt>$chr:s$</tt></td>
<td>character constant</td>
</tr>
<tr>
<td><tt>ExCoe loc e None t2</tt></td>
<td align="center"><tt>($e$ :> $t2$)</tt></td>
<td>coercion</td>
</tr>
<tr>
<td><tt>ExCoe loc e (Some t1) t2</tt></td>
<td align="center"><tt>($e$ : $t1$ :> $t2$)</tt></td>
<td>coercion</td>
</tr>
<tr>
<td><tt>ExFlo loc s</tt></td>
<td align="center"><tt>$flo:s$</tt></td>
<td>float constant</td>
</tr>
<tr>
<td><tt>ExFor loc s e1 e2 True le</tt></td>
<td align="center"><tt>for $lid:s$ = $e1$ to $e2$ do { $list:le$ }</tt></td>
<td>for (increasing)</td>
</tr>
<tr>
<td><tt>ExFor loc s e1 e2 False le</tt></td>
<td align="center"><tt>for $lid:s$ = $e1$ downto $e2$ do { $list:le$ }</tt></td>
<td>for (decreasing)</td>
</tr>
<tr>
<td><tt>ExFor loc s e1 e2 b le</tt></td>
<td align="center"><tt>for $lid:s$ = $e1$ $to:b$ $e2$ do { $list:le$ }</tt></td>
<td>for</td>
</tr>
<tr>
<td><tt>ExFun loc lpee</tt></td>
<td align="center"><tt>fun [ $list:lpee$ ]</tt></td>
<td>function <a href="#expr_2">(2)</a></td>
</tr>
<tr>
<td><tt>ExIfe loc e1 e2 e3</tt></td>
<td align="center"><tt>if $e1$ then $e2$ else $e3$</tt></td>
<td>if</td>
</tr>
<tr>
<td><tt>ExInt loc s1 ""</tt></td>
<td align="center"><tt>$int:s1$</tt></td>
<td>integer constant</td>
</tr>
<tr>
<td><tt>ExInt loc s1 "l"</tt></td>
<td align="center"><tt>$int32:s1$</tt></td>
<td>integer 32 bits</td>
</tr>
<tr>
<td><tt>ExInt loc s1 "L"</tt></td>
<td align="center"><tt>$int64:s1$</tt></td>
<td>integer 64 bits</td>
</tr>
<tr>
<td><tt>ExInt loc s1 "n"</tt></td>
<td align="center"><tt>$nativeint:s1$</tt></td>
<td>native integer</td>
</tr>
<tr>
<td><tt>ExLab loc p None</tt></td>
<td align="center"><tt>~{$p$}</tt></td>
<td>label</td>
</tr>
<tr>
<td><tt>ExLab loc p (Some e)</tt></td>
<td align="center"><tt>~{$p$ = $e$}</tt></td>
<td>label</td>
</tr>
<tr>
<td><tt>ExLab loc p oe</tt></td>
<td align="center"><tt>~{$p$ $opt:oe$}</tt></td>
<td>label</td>
</tr>
<tr>
<td><tt>ExLaz loc e</tt></td>
<td align="center"><tt>lazy $e$</tt></td>
<td>lazy</td>
</tr>
<tr>
<td><tt>ExLet loc True lpe e</tt></td>
<td align="center"><tt>let rec $list:lpe$ in $e$</tt></td>
<td>let rec</td>
</tr>
<tr>
<td><tt>ExLet loc False lpe e</tt></td>
<td align="center"><tt>let $list:lpe$ in $e$</tt></td>
<td>let not rec</td>
</tr>
<tr>
<td><tt>ExLet loc b lpe e</tt></td>
<td align="center"><tt>let $flag:b$ $list:lpe$ in $e$</tt></td>
<td>let</td>
</tr>
<tr>
<td><tt>ExLid loc s</tt></td>
<td align="center"><tt>$lid:s$</tt></td>
<td>lowercase identifier</td>
</tr>
<tr>
<td><tt>ExLmd loc s me e</tt></td>
<td align="center"><tt>let module $uid:s$ = $me$ in $e$</tt></td>
<td>let module</td>
</tr>
<tr>
<td><tt>ExMat loc e lpee</tt></td>
<td align="center"><tt>match $e$ with [ $list:lpee$ ]</tt></td>
<td>match <a href="#expr_2">(2)</a></td>
</tr>
<tr>
<td><tt>ExNew loc ls</tt></td>
<td align="center"><tt>new $list:ls$</tt></td>
<td>new</td>
</tr>
<tr>
<td><tt>ExObj loc None lcsi</tt></td>
<td align="center"><tt>object $list:lcsi$ end</tt></td>
<td>object expression</td>
</tr>
<tr>
<td><tt>ExObj loc (Some p) lcsi</tt></td>
<td align="center"><tt>object ($p$) $list:lcsi$ end</tt></td>
<td>object expression</td>
</tr>
<tr>
<td><tt>ExObj loc op lcsi</tt></td>
<td align="center"><tt>object $opt:op$ $list:lcsi$ end</tt></td>
<td>object expression</td>
</tr>
<tr>
<td><tt>ExOlb loc p None</tt></td>
<td align="center"><tt>?{$p$}</tt></td>
<td>option label</td>
</tr>
<tr>
<td><tt>ExOlb loc p (Some e)</tt></td>
<td align="center"><tt>?{$p$ = $e$}</tt></td>
<td>option label</td>
</tr>
<tr>
<td><tt>ExOlb loc p oe</tt></td>
<td align="center"><tt>?{$p$ $opt:oe$}</tt></td>
<td>option label</td>
</tr>
<tr>
<td><tt>ExOvr loc lse</tt></td>
<td align="center"><tt>{< $list:lse$ >}</tt></td>
<td>override</td>
</tr>
<tr>
<td><tt>ExPck loc me None</tt></td>
<td align="center"><tt>(module $me$)</tt></td>
<td>module packing</td>
</tr>
<tr>
<td><tt>ExPck loc me (Some mt)</tt></td>
<td align="center"><tt>(module $me$ : $mt$)</tt></td>
<td>module packing</td>
</tr>
<tr>
<td><tt>ExRec loc lpe None</tt></td>
<td align="center"><tt>{$list:lpe$}</tt></td>
<td>record</td>
</tr>
<tr>
<td><tt>ExRec loc lpe (Some e)</tt></td>
<td align="center"><tt>{($e$) with $list:lpe$}</tt></td>
<td>record</td>
</tr>
<tr>
<td><tt>ExSeq loc le</tt></td>
<td align="center"><tt>do { $list:le$ }</tt></td>
<td>sequence</td>
</tr>
<tr>
<td><tt>ExSnd loc e s</tt></td>
<td align="center"><tt>$e$ # $s$</tt></td>
<td>method call</td>
</tr>
<tr>
<td><tt>ExSte loc e1 e2</tt></td>
<td align="center"><tt>$e1$ .[ $e2$ ]</tt></td>
<td>string element</td>
</tr>
<tr>
<td><tt>ExStr loc s</tt></td>
<td align="center"><tt>$str:s$</tt></td>
<td>string</td>
</tr>
<tr>
<td><tt>ExTry loc e lpee</tt></td>
<td align="center"><tt>try $e$ with [ $list:lpee$ ]</tt></td>
<td>try <a href="#expr_2">(2)</a></td>
</tr>
<tr>
<td><tt>ExTup loc le</tt></td>
<td align="center"><tt>($list:le$)</tt></td>
<td>t-uple</td>
</tr>
<tr>
<td><tt>ExTyc loc e t</tt></td>
<td align="center"><tt>($e$ : $t$)</tt></td>
<td>type constraint</td>
</tr>
<tr>
<td><tt>ExUid loc s</tt></td>
<td align="center"><tt>$uid:s$</tt></td>
<td>uppercase identifier</td>
</tr>
<tr>
<td><tt>ExVrn loc s</tt></td>
<td align="center"><tt>` $s$</tt></td>
<td>variant</td>
</tr>
<tr>
<td><tt>ExWhi loc e le</tt></td>
<td align="center"><tt>while $e$ do { $list:le$ }</tt></td>
<td>while</td>
</tr>
</table>
<div id="expr_1" style="margin: 5mm 0 0 1cm">(1)
<p>Node used in the quotation expanders to tells at conversion to
OCaml compiler syntax tree time, that all locations of the
sub-tree is correcty located in the quotation. By default, in
quotations, the locations of all generated nodes are the location
of the whole quotation. This node allows to make an exception to
this rule, since we know that the antiquotation belongs to the
universe of the enclosing program. See the chapter
about <a href="quot.html">quotations</a> and, in particular, its
section about antiquotations.</p>
</div>
<div id="expr_2" style="margin: 5mm 0 0 1cm">(2)
<p>The variable "lpee" found in "function", "match" and "try"
statements correspond to a list of "<tt>(patt * option expr *
expr)</tt>" where the "<tt>option expr</tt>" is the "when"
optionally following the pattern:</p>
<pre>
p -> e
</pre>
<p>is represented by:</p>
<pre>
(p, None, e)
</pre>
<p>and</p>
<pre>
p when e1 -> e
</pre>
<p>is represented by:</p>
<pre>
(p, Some e1, e)
</pre>
</div>
<h3>patt</h3>
<p>Patterns of the language.</p>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:patt< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>PaAcc loc p1 p2</tt></td>
<td align="center"><tt>$p1$ . $p2$</tt></td>
<td>access</td>
</tr>
<tr>
<td><tt>PaAli loc p1 p2</tt></td>
<td align="center"><tt>($p1$ as $p2$)</tt></td>
<td>alias</td>
</tr>
<tr>
<td><tt>PaAnt loc p</tt></td>
<td align="center"><tt>$anti:p$</tt></td>
<td>antiquotation <a href="#patt_1">(1)</a></td>
</tr>
<tr>
<td><tt>PaAny loc</tt></td>
<td align="center"><tt>_</tt></td>
<td>wildcard</td>
</tr>
<tr>
<td><tt>PaApp loc p1 p2</tt></td>
<td align="center"><tt>$p1$ $p2$</tt></td>
<td>application</td>
</tr>
<tr>
<td><tt>PaArr loc lp</tt></td>
<td align="center"><tt>[| $list:lp$ |]</tt></td>
<td>array</td>
</tr>
<tr>
<td><tt>PaChr loc s</tt></td>
<td align="center"><tt>$chr:s$</tt></td>
<td>character</td>
</tr>
<tr>
<td><tt>PaFlo loc s</tt></td>
<td align="center"><tt>$flo:s$</tt></td>
<td>float</td>
</tr>
<tr>
<td><tt>PaInt loc s1 ""</tt></td>
<td align="center"><tt>$int:s1$</tt></td>
<td>integer constant</td>
</tr>
<tr>
<td><tt>PaInt loc s1 "l"</tt></td>
<td align="center"><tt>$int32:s1$</tt></td>
<td>integer 32 bits</td>
</tr>
<tr>
<td><tt>PaInt loc s1 "L"</tt></td>
<td align="center"><tt>$int64:s1$</tt></td>
<td>integer 64 bits</td>
</tr>
<tr>
<td><tt>PaInt loc s1 "n"</tt></td>
<td align="center"><tt>$nativeint:s1$</tt></td>
<td>native integer</td>
</tr>
<tr>
<td><tt>PaLab loc p1 None</tt></td>
<td align="center"><tt>~{$p1$}</tt></td>
<td>label</td>
</tr>
<tr>
<td><tt>PaLab loc p1 (Some p2)</tt></td>
<td align="center"><tt>~{$p1$ = $p2$}</tt></td>
<td>label</td>
</tr>
<tr>
<td><tt>PaLab loc p1 op2</tt></td>
<td align="center"><tt>~{$p1$ $opt:op2$}</tt></td>
<td>label</td>
</tr>
<tr>
<td><tt>PaLaz loc p</tt></td>
<td align="center"><tt>lazy $p$</tt></td>
<td>lazy</td>
</tr>
<tr>
<td><tt>PaLid loc s</tt></td>
<td align="center"><tt>$lid:s$</tt></td>
<td>lowercase identifier</td>
</tr>
<tr>
<td><tt>PaNty loc s</tt></td>
<td align="center"><tt>(type $lid:s$)</tt></td>
<td>new type</td>
</tr>
<tr>
<td><tt>PaOlb loc p None</tt></td>
<td align="center"><tt>?{$p$}</tt></td>
<td>option label</td>
</tr>
<tr>
<td><tt>PaOlb loc p (Some e)</tt></td>
<td align="center"><tt>?{$p$ = $e$}</tt></td>
<td>option label</td>
</tr>
<tr>
<td><tt>PaOlb loc p oe</tt></td>
<td align="center"><tt>?{$p$ $opt:oe$}</tt></td>
<td>option label</td>
</tr>
<tr>
<td><tt>PaOrp loc p1 p2</tt></td>
<td align="center"><tt>$p1$ | $p2$</tt></td>
<td>or</td>
</tr>
<tr>
<td><tt>PaRec loc lpp</tt></td>
<td align="center"><tt>{ $list:lpp$ }</tt></td>
<td>record</td>
</tr>
<tr>
<td><tt>PaRng loc p1 p2</tt></td>
<td align="center"><tt>$p1$ .. $p2$</tt></td>
<td>range</td>
</tr>
<tr>
<td><tt>PaStr loc s</tt></td>
<td align="center"><tt>$str:s$</tt></td>
<td>string</td>
</tr>
<tr>
<td><tt>PaTup loc lp</tt></td>
<td align="center"><tt>($list:lp$)</tt></td>
<td>t-uple</td>
</tr>
<tr>
<td><tt>PaTyc loc p t</tt></td>
<td align="center"><tt>($p$ : $t$)</tt></td>
<td>type constraint</td>
</tr>
<tr>
<td><tt>PaTyp loc ls</tt></td>
<td align="center"><tt># $list:ls$</tt></td>
<td>type pattern</td>
</tr>
<tr>
<td><tt>PaUid loc s</tt></td>
<td align="center"><tt>$uid:s$</tt></td>
<td>uppercase identifier</td>
</tr>
<tr>
<td><tt>PaUnp loc s None</tt></td>
<td align="center"><tt>(module $uid:s$)</tt></td>
<td>module unpacking</td>
</tr>
<tr>
<td><tt>PaUnp loc s (Some mt)</tt></td>
<td align="center"><tt>(module $uid:s$ : $mt$)</tt></td>
<td>module unpacking</td>
</tr>
<tr>
<td><tt>PaVrn loc s</tt></td>
<td align="center"><tt>` $s$</tt></td>
<td>variant</td>
</tr>
</table>
<div id="patt_1" style="margin: 5mm 0 0 1cm">(1)
Node used to specify an antiquotation area, like for the
equivalent node in expressions. See above.
</div>
<h3>ctyp</h3>
<p>Type expressions of the language.</p>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:ctyp< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>TyAcc loc t1 t2</tt></td>
<td align="center"><tt>$t1$ . $t2$</tt></td>
<td>access</td>
</tr>
<tr>
<td><tt>TyAli loc t1 t2</tt></td>
<td align="center"><tt>$t1$ as $t2$</tt></td>
<td>alias</td>
</tr>
<tr>
<td><tt>TyAny loc</tt></td>
<td align="center"><tt>_</tt></td>
<td>wildcard</td>
</tr>
<tr>
<td><tt>TyApp loc t1 t2</tt></td>
<td align="center"><tt>$t1$ $t2$</tt></td>
<td>application</td>
</tr>
<tr>
<td><tt>TyArr loc t1 t2</tt></td>
<td align="center"><tt>$t1$ -> $t2$</tt></td>
<td>arrow</td>
</tr>
<tr>
<td><tt>TyCls loc ls</tt></td>
<td align="center"><tt># $list:ls$</tt></td>
<td>class</td>
</tr>
<tr>
<td><tt>TyLab loc s t</tt></td>
<td align="center"><tt>~$s$: $t$</tt></td>
<td>label</td>
</tr>
<tr>
<td><tt>TyLid loc s</tt></td>
<td align="center"><tt>$lid:s$</tt></td>
<td>lowercase identifier</td>
</tr>
<tr>
<td><tt>TyMan loc t1 True t2</tt></td>
<td align="center"><tt>$t1$ == private $t2$</tt></td>
<td>manifest</td>
</tr>
<tr>
<td><tt>TyMan loc t1 False t2</tt></td>
<td align="center"><tt>$t1$ == $t2$</tt></td>
<td>manifest</td>
</tr>
<tr>
<td><tt>TyMan loc t1 b t2</tt></td>
<td align="center"><tt>$t1$ == $priv:b$ $t2$</tt></td>
<td>manifest</td>
</tr>
<tr>
<td><tt>TyObj loc lst True</tt></td>
<td align="center"><tt>< $list:lst$ .. ></tt></td>
<td>object</td>
</tr>
<tr>
<td><tt>TyObj loc lst False</tt></td>
<td align="center"><tt>< $list:lst$ ></tt></td>
<td>object</td>
</tr>
<tr>
<td><tt>TyObj loc lst b</tt></td>
<td align="center"><tt>< $list:lst$ $flag:b$ ></tt></td>
<td>object</td>
</tr>
<tr>
<td><tt>TyOlb loc s t</tt></td>
<td align="center"><tt>?$s$: $t$</tt></td>
<td>option label</td>
</tr>
<tr>
<td><tt>TyPck loc mt</tt></td>
<td align="center"><tt>(module $mt$)</tt></td>
<td>package</td>
</tr>
<tr>
<td><tt>TyPol loc ls t</tt></td>
<td align="center"><tt>! $list:ls$ . $t$</tt></td>
<td>polymorph</td>
</tr>
<tr>
<td><tt>TyQuo loc s</tt></td>
<td align="center"><tt>'$s$</tt></td>
<td>variable</td>
</tr>
<tr>
<td><tt>TyRec loc llsbt</tt></td>
<td align="center"><tt>{ $list:llsbt$ }</tt></td>
<td>record</td>
</tr>
<tr>
<td><tt>TySum loc llslt</tt></td>
<td align="center"><tt>[ $list:llslt$ ]</tt></td>
<td>sum</td>
</tr>
<tr>
<td><tt>TyTup loc lt</tt></td>
<td align="center"><tt>( $list:lt$ )</tt></td>
<td>t-uple</td>
</tr>
<tr>
<td><tt>TyUid loc s</tt></td>
<td align="center"><tt>$uid:s$</tt></td>
<td>uppercase identifier</td>
</tr>
<tr>
<td><tt>TyVrn loc lpv None</tt></td>
<td align="center"><tt>[ = $list:lpv$ ]</tt></td>
<td>variant</td>
</tr>
<tr>
<td><tt>TyVrn loc lpv (Some None)</tt></td>
<td align="center"><tt>[ > $list:lpv$ ]</tt></td>
<td>variant</td>
</tr>
<tr>
<td><tt>TyVrn loc lpv (Some (Some []))</tt></td>
<td align="center"><tt>[ < $list:lpv$ ]</tt></td>
<td>variant</td>
</tr>
<tr>
<td><tt>TyVrn loc lpv (Some (Some ls))</tt></td>
<td align="center"><tt>[ < $list:lpv$ > $list:ls$ ]</tt></td>
<td>variant</td>
</tr>
</table>
<h3>modules...</h3>
<h4>str_item</h4>
<p>Structure items, i.e. phrases in a ".ml" file or "struct"
elements.</p>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:str_item< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>StCls loc lcice</tt></td>
<td align="center"><tt>class $list:lcice$</tt></td>
<td>class declaration</td>
</tr>
<tr>
<td><tt>StClt loc lcict</tt></td>
<td align="center"><tt>class type $list:lcict$</tt></td>
<td>class type declaration</td>
</tr>
<tr>
<td><tt>StDcl loc lsi</tt></td>
<td align="center"><tt>declare $list:lsi$ end</tt></td>
<td>declare</td>
</tr>
<tr>
<td><tt>StDir loc s None</tt></td>
<td align="center"><tt># $lid:s$</tt></td>
<td>directive</td>
</tr>
<tr>
<td><tt>StDir loc s (Some e)</tt></td>
<td align="center"><tt># $lid:s$ $e$</tt></td>
<td>directive</td>
</tr>
<tr>
<td><tt>StDir loc s oe</tt></td>
<td align="center"><tt># $lid:s$ $opt:oe$</tt></td>
<td>directive</td>
</tr>
<tr>
<td><tt>StExc loc s [] []</tt></td>
<td align="center"><tt>exception $uid:s$</tt></td>
<td>exception</td>
</tr>
<tr>
<td><tt>StExc loc s lt []</tt></td>
<td align="center"><tt>exception $uid:s$ of $list:lt$</tt></td>
<td>exception</td>
</tr>
<tr>
<td><tt>StExc loc s [] ls</tt></td>
<td align="center"><tt>exception $uid:s$ = $list:ls$</tt></td>
<td>exception</td>
</tr>
<tr>
<td><tt>StExc loc s lt ls</tt></td>
<td align="center"><tt>exception $uid:s$ of $list:lt$ = $list:ls$</tt></td>
<td>exception</td>
</tr>
<tr>
<td><tt>StExp loc e</tt></td>
<td align="center"><tt>$exp:e$</tt></td>
<td>expression</td>
</tr>
<tr>
<td><tt>StExt loc s t ls</tt></td>
<td align="center"><tt>external $s$ : $t$ = $list:ls$</tt></td>
<td>external</td>
</tr>
<tr>
<td><tt>StInc loc me</tt></td>
<td align="center"><tt>include $me$</tt></td>
<td>include</td>
</tr>
<tr>
<td><tt>StMod loc True lsme</tt></td>
<td align="center"><tt>module rec $list:lsme$</tt></td>
<td>module rec</td>
</tr>
<tr>
<td><tt>StMod loc False lsme</tt></td>
<td align="center"><tt>module $list:lsme$</tt></td>
<td>module non rec</td>
</tr>
<tr>
<td><tt>StMod loc b lsme</tt></td>
<td align="center"><tt>module $flag:b$ $list:lsme$</tt></td>
<td>module</td>
</tr>
<tr>
<td><tt>StMty loc s mt</tt></td>
<td align="center"><tt>module type $s$ = $mt$</tt></td>
<td>module type</td>
</tr>
<tr>
<td><tt>StOpn loc ls</tt></td>
<td align="center"><tt>open $list:ls$</tt></td>
<td>open</td>
</tr>
<tr>
<td><tt>StTyp loc ltd</tt></td>
<td align="center"><tt>type $list:ltd$</tt></td>
<td>type declaration</td>
</tr>
<tr>
<td><tt>StUse loc s lsil</tt></td>
<td align="center"><tt># $str:s$ $list:lsil$</tt></td>
<td>... internal use ... <a href="#t_str_item_1">(1)</a></td>
</tr>
<tr>
<td><tt>StVal loc True lpe</tt></td>
<td align="center"><tt>value rec $list:lpe$</tt></td>
<td>value rec</td>
</tr>
<tr>
<td><tt>StVal loc False lpe</tt></td>
<td align="center"><tt>value $list:lpe$</tt></td>
<td>value non rec</td>
</tr>
<tr>
<td><tt>StVal loc b lpe</tt></td>
<td align="center"><tt>value $flag:b$ $list:lpe$</tt></td>
<td>value</td>
</tr>
</table>
<div id="t_str_item_1" style="margin: 5mm 0 0 1cm">(1)
<p>Node internally used to specify a different file name applying to
the whole subtree. This is generated by the directive "use" and
used when converting to the OCaml syntax tree which needs the file
name in its location type.</p>
</div>
<h4>sig_item</h4>
<p>Signature items, i.e. phrases in a ".mli" file or elements
inside "sig ... end".</p>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:sig_item< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>SgCls loc lcict</tt></td>
<td align="center"><tt>class $list:lcict$</tt></td>
<td>class</td>
</tr>
<tr>
<td><tt>SgClt loc lcict</tt></td>
<td align="center"><tt>class type $list:lcict$</tt></td>
<td>class type</td>
</tr>
<tr>
<td><tt>SgDcl loc lsi</tt></td>
<td align="center"><tt>declare $list:lsi$ end</tt></td>
<td>declare</td>
</tr>
<tr>
<td><tt>SgDir loc s None</tt></td>
<td align="center"><tt># $lid:s$</tt></td>
<td>directive</td>
</tr>
<tr>
<td><tt>SgDir loc s (Some e)</tt></td>
<td align="center"><tt># $lid:s$ $e$</tt></td>
<td>directive</td>
</tr>
<tr>
<td><tt>SgDir loc s oe</tt></td>
<td align="center"><tt># $lid:s$ $opt:oe$</tt></td>
<td>directive</td>
</tr>
<tr>
<td><tt>SgExc loc s []</tt></td>
<td align="center"><tt>exception $s$</tt></td>
<td>exception</td>
</tr>
<tr>
<td><tt>SgExc loc s lt</tt></td>
<td align="center"><tt>exception $s$ of $list:lt$</tt></td>
<td>exception</td>
</tr>
<tr>
<td><tt>SgExt loc s t ls</tt></td>
<td align="center"><tt>external $s$ : $t$ = $list:ls$</tt></td>
<td>external</td>
</tr>
<tr>
<td><tt>SgInc loc mt</tt></td>
<td align="center"><tt>include $mt$</tt></td>
<td>include</td>
</tr>
<tr>
<td><tt>SgMod loc True lsmt</tt></td>
<td align="center"><tt>module rec $list:lsmt$</tt></td>
<td>module rec</td>
</tr>
<tr>
<td><tt>SgMod loc False lsmt</tt></td>
<td align="center"><tt>module $list:lsmt$</tt></td>
<td>module non rec</td>
</tr>
<tr>
<td><tt>SgMod loc b lsmt</tt></td>
<td align="center"><tt>module $flag:b$ $list:lsmt$</tt></td>
<td>module</td>
</tr>
<tr>
<td><tt>SgMty loc s mt</tt></td>
<td align="center"><tt>module type $s$ = $mt$</tt></td>
<td>module type</td>
</tr>
<tr>
<td><tt>SgOpn loc ls</tt></td>
<td align="center"><tt>open $list:ls$</tt></td>
<td>open</td>
</tr>
<tr>
<td><tt>SgTyp loc ltd</tt></td>
<td align="center"><tt>type $list:ltd$</tt></td>
<td>type declaration</td>
</tr>
<tr>
<td><tt>SgUse loc s lsil</tt></td>
<td align="center"><tt># $str:s$ $list:lsil$</tt></td>
<td>... internal use ... <a href="#t_sig_item_1">(1)</a></td>
</tr>
<tr>
<td><tt>SgVal loc s t</tt></td>
<td align="center"><tt>value $s$ : $t$</tt></td>
<td>value</td>
</tr>
</table>
<div id="t_sig_item_1" style="margin: 5mm 0 0 1cm">(1)
<p>Same remark as for "<tt>str_item</tt>" above.</p>
</div>
<h4>module_expr</h4>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:module_expr< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>MeAcc loc me1 me2</tt></td>
<td align="center"><tt>$me1$ . $me2$</tt></td>
<td>access</td>
</tr>
<tr>
<td><tt>MeApp loc me1 me2</tt></td>
<td align="center"><tt>$me1$ $me2$</tt></td>
<td>application</td>
</tr>
<tr>
<td><tt>MeFun loc s mt me</tt></td>
<td align="center"><tt>functor ($s$ : $mt$) -> $me$</tt></td>
<td>functor</td>
</tr>
<tr>
<td><tt>MeStr loc lsi</tt></td>
<td align="center"><tt>struct $list:lsi$ end</tt></td>
<td>struct</td>
</tr>
<tr>
<td><tt>MeTyc loc me mt</tt></td>
<td align="center"><tt>($me$ : $mt$)</tt></td>
<td>module type constraint</td>
</tr>
<tr>
<td><tt>MeUid loc s</tt></td>
<td align="center"><tt>$uid:s$</tt></td>
<td>uppercase identifier</td>
</tr>
<tr>
<td><tt>MeUnp loc e None</tt></td>
<td align="center"><tt>(value $e$)</tt></td>
<td>module unpacking</td>
</tr>
<tr>
<td><tt>MeUnp loc e (Some mt)</tt></td>
<td align="center"><tt>(value $e$ : $mt$)</tt></td>
<td>module unpacking</td>
</tr>
</table>
<h4>module_type</h4>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:module_type< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>MtAcc loc mt1 mt2</tt></td>
<td align="center"><tt>$mt1$ . $mt2$</tt></td>
<td>access</td>
</tr>
<tr>
<td><tt>MtApp loc mt1 mt2</tt></td>
<td align="center"><tt>$mt1$ $mt2$</tt></td>
<td>application</td>
</tr>
<tr>
<td><tt>MtFun loc s mt1 mt2</tt></td>
<td align="center"><tt>functor ($s$ : $mt1$) -> $mt2$</tt></td>
<td>functor</td>
</tr>
<tr>
<td><tt>MtLid loc s</tt></td>
<td align="center"><tt>$lid:s$</tt></td>
<td>lowercase identifier</td>
</tr>
<tr>
<td><tt>MtQuo loc s</tt></td>
<td align="center"><tt>' $s$</tt></td>
<td>abstract</td>
</tr>
<tr>
<td><tt>MtSig loc lsi</tt></td>
<td align="center"><tt>sig $list:lsi$ end</tt></td>
<td>signature</td>
</tr>
<tr>
<td><tt>MtTyo loc me</tt></td>
<td align="center"><tt>module type of $me$</tt></td>
<td>of module expression</td>
</tr>
<tr>
<td><tt>MtUid loc s</tt></td>
<td align="center"><tt>$uid:s$</tt></td>
<td>uppercase identifier</td>
</tr>
<tr>
<td><tt>MtWit loc mt lwc</tt></td>
<td align="center"><tt>$mt$ with $list:lwc$</tt></td>
<td>with construction</td>
</tr>
</table>
<h3>classes...</h3>
<h4>class_expr</h4>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:class_expr< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>CeApp loc ce e</tt></td>
<td align="center"><tt>$ce$ $e$</tt></td>
<td>application</td>
</tr>
<tr>
<td><tt>CeCon loc ls lt</tt></td>
<td align="center"><tt>[ $list:lt$ ] $list:ls$</tt></td>
<td>constructor</td>
</tr>
<tr>
<td><tt>CeFun loc p ce</tt></td>
<td align="center"><tt>fun $p$ -> $ce$</tt></td>
<td>function</td>
</tr>
<tr>
<td><tt>CeLet loc True lpe ce</tt></td>
<td align="center"><tt>let rec $list:lpe$ in $ce$</tt></td>
<td>let rec</td>
</tr>
<tr>
<td><tt>CeLet loc False lpe ce</tt></td>
<td align="center"><tt>let $list:lpe$ in $ce$</tt></td>
<td>let non rec</td>
</tr>
<tr>
<td><tt>CeLet loc b lpe ce</tt></td>
<td align="center"><tt>let $flag:b$ $list:lpe$ in $ce$</tt></td>
<td>let</td>
</tr>
<tr>
<td><tt>CeStr loc None lcsi</tt></td>
<td align="center"><tt>object $list:lcsi$ end</tt></td>
<td>object</td>
</tr>
<tr>
<td><tt>CeStr loc (Some p) lcsi</tt></td>
<td align="center"><tt>object ($p$) $list:lcsi$ end</tt></td>
<td>object</td>
</tr>
<tr>
<td><tt>CeStr loc op lcsi</tt></td>
<td align="center"><tt>object $opt:op$ $list:lcsi$ end</tt></td>
<td>object</td>
</tr>
<tr>
<td><tt>CeTyc loc ce ct</tt></td>
<td align="center"><tt>($ce$ : $ct$)</tt></td>
<td>class type constraint</td>
</tr>
</table>
<h4>class_type</h4>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:class_type< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>CtAcc loc ct1 ct2</tt></td>
<td align="center"><tt>$ct1$ . $ct2$</tt></td>
<td>access</td>
</tr>
<tr>
<td><tt>CtApp loc ct1 ct2</tt></td>
<td align="center"><tt>$ct1$ $ct2$</tt></td>
<td>application</td>
</tr>
<tr>
<td><tt>CtCon loc ct lt</tt></td>
<td align="center"><tt>$ct$ [ $list:lt$ ]</tt></td>
<td>constructor</td>
</tr>
<tr>
<td><tt>CtFun loc t ct</tt></td>
<td align="center"><tt>[ $t$ ] -> $ct$</tt></td>
<td>arrow</td>
</tr>
<tr>
<td><tt>CtIde loc s</tt></td>
<td align="center"><tt>$id:s$</tt></td>
<td>identifier</td>
</tr>
<tr>
<td><tt>CtSig loc None lcsi</tt></td>
<td align="center"><tt>object $list:lcsi$ end</tt></td>
<td>object</td>
</tr>
<tr>
<td><tt>CtSig loc (Some t) lcsi</tt></td>
<td align="center"><tt>object ($t$) $list:lcsi$ end</tt></td>
<td>object</td>
</tr>
<tr>
<td><tt>CtSig loc ot lcsi</tt></td>
<td align="center"><tt>object $opt:ot$ $list:lcsi$ end</tt></td>
<td>object</td>
</tr>
</table>
<h4>class_str_item</h4>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:class_str_item< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>CrCtr loc t1 t2</tt></td>
<td align="center"><tt>type $t1$ = $t2$</tt></td>
<td>type constraint</td>
</tr>
<tr>
<td><tt>CrDcl loc lcsi</tt></td>
<td align="center"><tt>declare $list:lcsi$ end</tt></td>
<td>declaration list</td>
</tr>
<tr>
<td><tt>CrInh loc ce None</tt></td>
<td align="center"><tt>inherit $ce$</tt></td>
<td>inheritance</td>
</tr>
<tr>
<td><tt>CrInh loc ce (Some s)</tt></td>
<td align="center"><tt>inherit $ce$ $opt:Some s$</tt></td>
<td>inheritance</td>
</tr>
<tr>
<td><tt>CrInh loc ce os</tt></td>
<td align="center"><tt>inherit $ce$ $opt:os$</tt></td>
<td>inheritance</td>
</tr>
<tr>
<td><tt>CrIni loc e</tt></td>
<td align="center"><tt>initializer $e$</tt></td>
<td>initialization</td>
</tr>
<tr>
<td><tt>CrMth loc True True s None e</tt></td>
<td align="center"><tt>method! private $lid:s$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc True True s (Some t) e</tt></td>
<td align="center"><tt>method! private $lid:s$ : $t$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc True True s ot e</tt></td>
<td align="center"><tt>method! private $lid:s$ $opt:ot$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc True False s None e</tt></td>
<td align="center"><tt>method! $lid:s$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc True False s (Some t) e</tt></td>
<td align="center"><tt>method! $lid:s$ : $t$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc True False s ot e</tt></td>
<td align="center"><tt>method! $lid:s$ $opt:ot$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc True b2 s None e</tt></td>
<td align="center"><tt>method! $priv:b2$ $lid:s$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc True b2 s (Some t) e</tt></td>
<td align="center"><tt>method! $priv:b2$ $lid:s$ : $t$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc True b2 s ot e</tt></td>
<td align="center"><tt>method! $priv:b2$ $lid:s$ $opt:ot$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc False True s None e</tt></td>
<td align="center"><tt>method private $lid:s$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc False True s (Some t) e</tt></td>
<td align="center"><tt>method private $lid:s$ : $t$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc False True s ot e</tt></td>
<td align="center"><tt>method private $lid:s$ $opt:ot$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc False False s None e</tt></td>
<td align="center"><tt>method $lid:s$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc False False s (Some t) e</tt></td>
<td align="center"><tt>method $lid:s$ : $t$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc False False s ot e</tt></td>
<td align="center"><tt>method $lid:s$ $opt:ot$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc False b2 s None e</tt></td>
<td align="center"><tt>method $priv:b2$ $lid:s$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc False b2 s (Some t) e</tt></td>
<td align="center"><tt>method $priv:b2$ $lid:s$ : $t$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc False b2 s ot e</tt></td>
<td align="center"><tt>method $priv:b2$ $lid:s$ $opt:ot$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc b1 True s None e</tt></td>
<td align="center"><tt>method $!:b1$ private $lid:s$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc b1 True s (Some t) e</tt></td>
<td align="center"><tt>method $!:b1$ private $lid:s$ : $t$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc b1 True s ot e</tt></td>
<td align="center"><tt>method $!:b1$ private $lid:s$ $opt:ot$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc b1 False s None e</tt></td>
<td align="center"><tt>method $!:b1$ $lid:s$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc b1 False s (Some t) e</tt></td>
<td align="center"><tt>method $!:b1$ $lid:s$ : $t$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc b1 False s ot e</tt></td>
<td align="center"><tt>method $!:b1$ $lid:s$ $opt:ot$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc b1 b2 s None e</tt></td>
<td align="center"><tt>method $!:b1$ $priv:b2$ $lid:s$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc b1 b2 s (Some t) e</tt></td>
<td align="center"><tt>method $!:b1$ $priv:b2$ $lid:s$ : $t$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrMth loc b1 b2 s ot e</tt></td>
<td align="center"><tt>method $!:b1$ $priv:b2$ $lid:s$ $opt:ot$ = $e$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CrVal loc True True s e</tt></td>
<td align="center"><tt>value! mutable $lid:s$ = $e$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CrVal loc True False s e</tt></td>
<td align="center"><tt>value! $lid:s$ = $e$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CrVal loc True b2 s e</tt></td>
<td align="center"><tt>value! $flag:b2$ $lid:s$ = $e$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CrVal loc False True s e</tt></td>
<td align="center"><tt>value mutable $lid:s$ = $e$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CrVal loc False False s e</tt></td>
<td align="center"><tt>value $lid:s$ = $e$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CrVal loc False b2 s e</tt></td>
<td align="center"><tt>value $flag:b2$ $lid:s$ = $e$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CrVal loc b1 True s e</tt></td>
<td align="center"><tt>value $!:b1$ mutable $lid:s$ = $e$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CrVal loc b1 False s e</tt></td>
<td align="center"><tt>value $!:b1$ $lid:s$ = $e$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CrVal loc b1 b2 s e</tt></td>
<td align="center"><tt>value $!:b1$ $flag:b2$ $lid:s$ = $e$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CrVav loc True s t</tt></td>
<td align="center"><tt>value virtual mutable $lid:s$ : $t$</tt></td>
<td>virtual value</td>
</tr>
<tr>
<td><tt>CrVav loc False s t</tt></td>
<td align="center"><tt>value virtual $lid:s$ : $t$</tt></td>
<td>virtual value</td>
</tr>
<tr>
<td><tt>CrVav loc b s t</tt></td>
<td align="center"><tt>value virtual $flag:b$ $lid:s$ : $t$</tt></td>
<td>virtual value</td>
</tr>
<tr>
<td><tt>CrVir loc True s t</tt></td>
<td align="center"><tt>method virtual private $lid:s$ : $t$</tt></td>
<td>virtual method</td>
</tr>
<tr>
<td><tt>CrVir loc False s t</tt></td>
<td align="center"><tt>method virtual $lid:s$ : $t$</tt></td>
<td>virtual method</td>
</tr>
<tr>
<td><tt>CrVir loc b s t</tt></td>
<td align="center"><tt>method virtual $flag:b$ $lid:s$ : $t$</tt></td>
<td>virtual method</td>
</tr>
</table>
<h4>class_sig_item</h4>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:class_sig_item< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>CgCtr loc t1 t2</tt></td>
<td align="center"><tt>type $t1$ = $t2$</tt></td>
<td>type constraint</td>
</tr>
<tr>
<td><tt>CgDcl loc lcsi</tt></td>
<td align="center"><tt>declare $list:lcsi$ end</tt></td>
<td>declare</td>
</tr>
<tr>
<td><tt>CgInh loc ct</tt></td>
<td align="center"><tt>inherit $ct$</tt></td>
<td>inheritance</td>
</tr>
<tr>
<td><tt>CgMth loc True s t</tt></td>
<td align="center"><tt>method private $lid:s$ : $t$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CgMth loc False s t</tt></td>
<td align="center"><tt>method $lid:s$ : $t$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CgMth loc b s t</tt></td>
<td align="center"><tt>method $flag:b$ $lid:s$ : $t$</tt></td>
<td>method</td>
</tr>
<tr>
<td><tt>CgVal loc True s t</tt></td>
<td align="center"><tt>value mutable $lid:s$ : $t$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CgVal loc False s t</tt></td>
<td align="center"><tt>value $lid:s$ : $t$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CgVal loc b s t</tt></td>
<td align="center"><tt>value $flag:b$ $lid:s$ : $t$</tt></td>
<td>value</td>
</tr>
<tr>
<td><tt>CgVir loc True s t</tt></td>
<td align="center"><tt>method virtual private $lid:s$ : $t$</tt></td>
<td>virtual method</td>
</tr>
<tr>
<td><tt>CgVir loc False s t</tt></td>
<td align="center"><tt>method virtual $lid:s$ : $t$</tt></td>
<td>virtual method</td>
</tr>
<tr>
<td><tt>CgVir loc b s t</tt></td>
<td align="center"><tt>method virtual $flag:b$ $lid:s$ : $t$</tt></td>
<td>virtual method</td>
</tr>
</table>
<h3>other</h3>
<h4>type_decl</h4>
<p>What is after 'type' or 'and' in a type declaration.</p>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:type_decl< ... >></tt></th>
</tr>
<tr>
<td><tt>{tdNam=ls;tdPrm=ltv;tdPrv=True;tdDef=t;tdCon=ltt}</tt></td>
<td align="center"><tt>$tp:ls$ $list:ltv$ = private $t$ $list:ltt$</tt></td>
</tr>
<tr>
<td><tt>{tdNam=ls;tdPrm=ltv;tdPrv=False;tdDef=t;tdCon=ltt}</tt></td>
<td align="center"><tt>$tp:ls$ $list:ltv$ = $t$ $list:ltt$</tt></td>
</tr>
<tr>
<td><tt>{tdNam=ls;tdPrm=ltv;tdPrv=b;tdDef=t;tdCon=ltt}</tt></td>
<td align="center"><tt>$tp:ls$ $list:ltv$ = $priv:b$ $t$ $list:ltt$</tt></td>
</tr>
</table>
<h4>with_constr</h4>
<p>"With" possibly following a module type.</p>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:with_constr< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>WcMod loc ls me</tt></td>
<td align="center"><tt>module $list:ls$ = $me$</tt></td>
<td>with module</td>
</tr>
<tr>
<td><tt>WcMos loc ls me</tt></td>
<td align="center"><tt>module $list:ls$ := $me$</tt></td>
<td>with module substitution</td>
</tr>
<tr>
<td><tt>WcTyp loc ls ltv True t</tt></td>
<td align="center"><tt>type $list:ls$ $list:ltv$ = private $t$</tt></td>
<td>with type</td>
</tr>
<tr>
<td><tt>WcTyp loc ls ltv False t</tt></td>
<td align="center"><tt>type $list:ls$ $list:ltv$ = $t$</tt></td>
<td>with type</td>
</tr>
<tr>
<td><tt>WcTyp loc ls ltv b t</tt></td>
<td align="center"><tt>type $list:ls$ $list:ltv$ = $flag:b$ $t$</tt></td>
<td>with type</td>
</tr>
<tr>
<td><tt>WcTys loc ls ltv t</tt></td>
<td align="center"><tt>type $list:ls$ $list:ltv$ := $t$</tt></td>
<td>with type substitution</td>
</tr>
</table>
<h4>poly_variant</h4>
<p>Polymorphic variants.</p>
<table border="1">
<tr>
<th>Node</th>
<th><tt><:poly_variant< ... >></tt></th>
<th>Comment</th>
</tr>
<tr>
<td><tt>PvTag loc s True []</tt></td>
<td align="center"><tt>`$s$</tt></td>
<td>constructor</td>
</tr>
<tr>
<td><tt>PvTag loc s True lt</tt></td>
<td align="center"><tt>`$s$ of & $list:lt$</tt></td>
<td>constructor</td>
</tr>
<tr>
<td><tt>PvTag loc s False lt</tt></td>
<td align="center"><tt>`$s$ of $list:lt$</tt></td>
<td>constructor</td>
</tr>
<tr>
<td><tt>PvTag loc s b lt</tt></td>
<td align="center"><tt>`$s$ of $flag:b$ $list:lt$</tt></td>
<td>constructor</td>
</tr>
<tr>
<td><tt>PvInh loc t</tt></td>
<td align="center"><tt>$t$</tt></td>
<td>type</td>
</tr>
</table>
<div class="trailer">
</div>
</div>
</body>
</html>
|