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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="manual.css">
<TITLE>
Lexical conventions
</TITLE>
</HEAD>
<BODY >
<A HREF="manual008.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="manual010.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>
<H2 CLASS="section"><A NAME="htoc52">6.1</A> Lexical conventions</H2>
<H4 CLASS="subsubsection">Blanks</H4>
The following characters are considered as blanks: space, newline,
horizontal tabulation, carriage return, line feed and form feed. Blanks are
ignored, but they separate adjacent identifiers, literals and
keywords that would otherwise be confused as one single identifier,
literal or keyword.<BR>
<BR>
<H4 CLASS="subsubsection">Comments</H4>
Comments are introduced by the two characters <TT>(*</TT>, with no
intervening blanks, and terminated by the characters <TT>*)</TT>, with
no intervening blanks. Comments are treated as blank characters.
Comments do not occur inside string or character literals. Nested
comments are handled correctly.<BR>
<BR>
<H4 CLASS="subsubsection"><A NAME="xhtoc1"></A>Identifiers</H4><BR>
<BR>
<DIV CLASS="center"><TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=right NOWRAP>
<A NAME="ident"></A>
<FONT COLOR=maroon><I><TT>ident</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP> (<FONT COLOR=maroon><I><a href="#letter"><font color=maroon><TT>letter</TT></font></a></I></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT>) { <FONT COLOR=maroon><I><a href="#letter"><font color=maroon><TT>letter</TT></font></a></I></FONT>∣ <FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT>∣ <FONT COLOR=blue><TT>'</TT></FONT> }</TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<A NAME="letter"></A>
<FONT COLOR=maroon><I><TT>letter</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP> <FONT COLOR=blue><TT>A</TT></FONT> … <FONT COLOR=blue><TT>Z</TT></FONT> ∣ <FONT COLOR=blue><TT>a</TT></FONT> … <FONT COLOR=blue><TT>z</TT></FONT></TD>
</TR></TABLE></DIV><BR>
<BR>
Identifiers are sequences of letters, digits, <TT>_</TT> (the underscore
character), and <TT>'</TT> (the single quote), starting with a
letter or an underscore.
Letters contain at least the 52 lowercase and uppercase
letters from the ASCII set. The current implementation (except on
MacOS 9) also recognizes as letters all accented characters from the ISO
8859-1 (“ISO Latin 1”) set. All characters in an identifier are
meaningful. The current implementation accepts identifiers up to
16000000 characters in length.<BR>
<BR>
<H4 CLASS="subsubsection"><A NAME="xhtoc12"></A>Integer literals</H4><BR>
<BR>
<DIV CLASS="center"><TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=right NOWRAP>
<A NAME="integer-literal"></A>
<FONT COLOR=maroon><I><TT>integer-literal</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
[<FONT COLOR=blue><TT>-</TT></FONT>] (<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>) { <FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT> }</TD>
</TR>
<TR><TD ALIGN=right NOWRAP> </TD>
<TD ALIGN=right NOWRAP>∣</TD>
<TD ALIGN=left NOWRAP> [<FONT COLOR=blue><TT>-</TT></FONT>] (<FONT COLOR=blue><TT>0x</TT></FONT>∣ <FONT COLOR=blue><TT>0X</TT></FONT>) (<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>A</TT></FONT>…<FONT COLOR=blue><TT>F</TT></FONT>∣ <FONT COLOR=blue><TT>a</TT></FONT>…<FONT COLOR=blue><TT>f</TT></FONT>)
{ <FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>A</TT></FONT>…<FONT COLOR=blue><TT>F</TT></FONT>∣ <FONT COLOR=blue><TT>a</TT></FONT>…<FONT COLOR=blue><TT>f</TT></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT> }</TD>
</TR>
<TR><TD ALIGN=right NOWRAP> </TD>
<TD ALIGN=right NOWRAP>∣</TD>
<TD ALIGN=left NOWRAP> [<FONT COLOR=blue><TT>-</TT></FONT>] (<FONT COLOR=blue><TT>0o</TT></FONT>∣ <FONT COLOR=blue><TT>0O</TT></FONT>) (<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>7</TT></FONT>) { <FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>7</TT></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT> }</TD>
</TR>
<TR><TD ALIGN=right NOWRAP> </TD>
<TD ALIGN=right NOWRAP>∣</TD>
<TD ALIGN=left NOWRAP> [<FONT COLOR=blue><TT>-</TT></FONT>] (<FONT COLOR=blue><TT>0b</TT></FONT>∣ <FONT COLOR=blue><TT>0B</TT></FONT>) (<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>1</TT></FONT>) { <FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>1</TT></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT> }</TD>
</TR></TABLE></DIV><BR>
<BR>
An integer literal is a sequence of one or more digits, optionally
preceded by a minus sign. By default, integer literals are in decimal
(radix 10). The following prefixes select a different radix:
<BR>
<BR>
<DIV CLASS="center"><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1 WIDTH="80%">
<TR><TD ALIGN=center NOWRAP><B>Prefix</B></TD>
<TD ALIGN=center NOWRAP><B>Radix</B></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>
<TT>0x</TT>, <TT>0X</TT></TD>
<TD ALIGN=left NOWRAP>hexadecimal (radix 16)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>0o</TT>, <TT>0O</TT></TD>
<TD ALIGN=left NOWRAP>octal (radix 8)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>0b</TT>, <TT>0B</TT></TD>
<TD ALIGN=left NOWRAP>binary (radix 2)</TD>
</TR></TABLE></DIV><BR>
<BR>
(The initial <TT>0</TT> is the digit zero; the <TT>O</TT> for octal is the letter O.)
The interpretation of integer literals that fall outside the range of
representable integer values is undefined.<BR>
<BR>
For convenience and readability, underscore characters (<TT>_</TT>) are accepted
(and ignored) within integer literals.<BR>
<BR>
<H4 CLASS="subsubsection"><A NAME="xhtoc2"></A>Floating-point literals</H4><BR>
<BR>
<DIV CLASS="center"><TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=right NOWRAP>
<A NAME="float-literal"></A>
<FONT COLOR=maroon><I><TT>float-literal</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
[<FONT COLOR=blue><TT>-</TT></FONT>] (<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>) { <FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT> } [<FONT COLOR=blue><TT>.</TT></FONT> { <FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT> }]
[(<FONT COLOR=blue><TT>e</TT></FONT>∣ <FONT COLOR=blue><TT>E</TT></FONT>) [<FONT COLOR=blue><TT>+</TT></FONT>∣ <FONT COLOR=blue><TT>-</TT></FONT>] (<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>) { <FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT> }]</TD>
</TR></TABLE></DIV><BR>
<BR>
Floating-point decimals consist in an integer part, a decimal part and
an exponent part. The integer part is a sequence of one or more
digits, optionally preceded by a minus sign. The decimal part is a
decimal point followed by zero, one or more digits.
The exponent part is the character <TT>e</TT> or <TT>E</TT> followed by an
optional <TT>+</TT> or <TT>-</TT> sign, followed by one or more digits.
The decimal part or the exponent part can be omitted, but not both to
avoid ambiguity with integer literals.
The interpretation of floating-point literals that fall outside the
range of representable floating-point values is undefined.<BR>
<BR>
For convenience and readability, underscore characters (<TT>_</TT>) are accepted
(and ignored) within floating-point literals.<BR>
<BR>
<H4 CLASS="subsubsection"><A NAME="xhtoc3"></A>Character literals</H4>
<A NAME="s:characterliteral"></A><BR>
<BR>
<DIV CLASS="center"><TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=right NOWRAP>
<A NAME="char-literal"></A>
<FONT COLOR=maroon><I><TT>char-literal</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
<FONT COLOR=blue><TT>'</TT> <FONT COLOR=maroon><TT><I>regular-char</I></TT></FONT> <TT>'</TT></FONT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP> </TD>
<TD ALIGN=right NOWRAP>∣</TD>
<TD ALIGN=left NOWRAP> <FONT COLOR=blue><TT>'</TT> <FONT COLOR=maroon><TT><a href="#escape-sequence"><font color=maroon><I>escape-sequence</I></font></a></TT></FONT> <TT>'</TT></FONT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<A NAME="escape-sequence"></A>
<FONT COLOR=maroon><I><TT>escape-sequence</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
<FONT COLOR=blue><TT>\</TT></FONT> (<FONT COLOR=blue><TT>\</TT></FONT> ∣ <FONT COLOR=blue><TT>"</TT></FONT> ∣ <FONT COLOR=blue><TT>'</TT></FONT> ∣ <FONT COLOR=blue><TT>n</TT></FONT> ∣ <FONT COLOR=blue><TT>t</TT></FONT> ∣ <FONT COLOR=blue><TT>b</TT></FONT> ∣ <FONT COLOR=blue><TT>r</TT></FONT>)</TD>
</TR>
<TR><TD ALIGN=right NOWRAP> </TD>
<TD ALIGN=right NOWRAP>∣</TD>
<TD ALIGN=left NOWRAP> <FONT COLOR=blue><TT>\</TT></FONT> (<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>) (<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>) (<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>)</TD>
</TR>
<TR><TD ALIGN=right NOWRAP> </TD>
<TD ALIGN=right NOWRAP>∣</TD>
<TD ALIGN=left NOWRAP> <FONT COLOR=blue><TT>\x</TT></FONT> (<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>A</TT></FONT>…<FONT COLOR=blue><TT>F</TT></FONT>∣ <FONT COLOR=blue><TT>a</TT></FONT>…<FONT COLOR=blue><TT>f</TT></FONT>)
(<FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>A</TT></FONT>…<FONT COLOR=blue><TT>F</TT></FONT>∣ <FONT COLOR=blue><TT>a</TT></FONT>…<FONT COLOR=blue><TT>f</TT></FONT>)</TD>
</TR></TABLE></DIV><BR>
<BR>
Character literals are delimited by <TT>'</TT> (single quote) characters.
The two single quotes enclose either one character different from
<TT>'</TT> and <TT>\</TT>, or one of the escape sequences below:
<BR>
<BR>
<DIV CLASS="center"><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1 WIDTH="80%">
<TR><TD ALIGN=center NOWRAP><B>Sequence</B></TD>
<TD ALIGN=center NOWRAP><B>Character denoted</B></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>
<TT>\\</TT></TD>
<TD ALIGN=left NOWRAP>backslash (<TT>\</TT>)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>\"</TT></TD>
<TD ALIGN=left NOWRAP>double quote (<TT>"</TT>)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>\'</TT></TD>
<TD ALIGN=left NOWRAP>single quote (<TT>'</TT>)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>\n</TT></TD>
<TD ALIGN=left NOWRAP>linefeed (LF)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>\r</TT></TD>
<TD ALIGN=left NOWRAP>carriage return (CR)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>\t</TT></TD>
<TD ALIGN=left NOWRAP>horizontal tabulation (TAB)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>\b</TT></TD>
<TD ALIGN=left NOWRAP>backspace (BS)</TD>
</TR>
<TR style="background-color:yellow; color:red"><TD ALIGN=left NOWRAP><TT>\</TT><I>space</I></TD>
<TD ALIGN=left NOWRAP>space (SPC)</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>\</TT><I>ddd</I></TD>
<TD ALIGN=left NOWRAP>the character with ASCII code <I>ddd</I> in decimal</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>\x</TT><I>hh</I></TD>
<TD ALIGN=left NOWRAP>the character with ASCII code <I>hh</I> in hexadecimal</TD>
</TR></TABLE></DIV><BR>
<BR>
<H4 CLASS="subsubsection"><A NAME="xhtoc4"></A>String literals</H4>
<A NAME="s:stringliteral"></A><BR>
<BR>
<DIV CLASS="center"><TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=right NOWRAP>
<A NAME="string-literal"></A>
<FONT COLOR=maroon><I><TT>string-literal</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
<FONT COLOR=blue><TT>"</TT></FONT> { <FONT COLOR=maroon><I><a href="#string-character"><font color=maroon><TT>string-character</TT></font></a></I></FONT> } <FONT COLOR=blue><TT>"</TT></FONT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<A NAME="string-character"></A>
<FONT COLOR=maroon><I><TT>string-character</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
<FONT COLOR=maroon><I><TT>regular-char-str</TT></I></FONT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP> </TD>
<TD ALIGN=right NOWRAP>∣</TD>
<TD ALIGN=left NOWRAP> <FONT COLOR=maroon><I><a href="#escape-sequence"><font color=maroon><TT>escape-sequence</TT></font></a></I></FONT></TD>
</TR></TABLE></DIV><BR>
<BR>
String literals are delimited by <TT>"</TT> (double quote) characters.
The two double quotes enclose a sequence of either characters
different from <TT>"</TT> and <TT>\</TT>, or escape sequences from the
table given above for character literals.<BR>
<BR>
To allow splitting long string literals across lines, the sequence
<TT>\</TT><I>newline blanks</I> (a <TT>\</TT> at end-of-line followed by any
number of blanks at the beginning of the next line) is ignored inside
string literals.<BR>
<BR>
The current implementation places practically no restrictions on the
length of string literals.<BR>
<BR>
<H4 CLASS="subsubsection"><A NAME="xhtoc5"></A>Naming labels</H4>
To avoid ambiguities, naming labels cannot just be defined
syntactically as the sequence of the three tokens <TT>~</TT>, <FONT COLOR=maroon><I><TT>ident</TT></I></FONT> and
<TT>:</TT>, and have to be defined at the lexical level.<BR>
<BR>
<DIV CLASS="center"><TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=right NOWRAP>
<A NAME="label"></A>
<FONT COLOR=maroon><I><TT>label</TT></I></FONT> </TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP> <FONT COLOR=blue><TT>~</TT></FONT> (<FONT COLOR=blue><TT>a</TT></FONT> … <FONT COLOR=blue><TT>z</TT></FONT>) { <FONT COLOR=maroon><I><a href="#letter"><font color=maroon><TT>letter</TT></font></a></I></FONT>∣ <FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT>∣ <FONT COLOR=blue><TT>'</TT></FONT> } <FONT COLOR=blue><TT>:</TT></FONT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<A NAME="optlabel"></A>
<FONT COLOR=maroon><I><TT>optlabel</TT></I></FONT> </TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP> <FONT COLOR=blue><TT>?</TT></FONT> (<FONT COLOR=blue><TT>a</TT></FONT> … <FONT COLOR=blue><TT>z</TT></FONT>) { <FONT COLOR=maroon><I><a href="#letter"><font color=maroon><TT>letter</TT></font></a></I></FONT>∣ <FONT COLOR=blue><TT>0</TT></FONT>…<FONT COLOR=blue><TT>9</TT></FONT>∣ <FONT COLOR=blue><TT>_</TT></FONT>∣ <FONT COLOR=blue><TT>'</TT></FONT> } <FONT COLOR=blue><TT>:</TT></FONT></TD>
</TR></TABLE></DIV><BR>
<BR>
Naming labels come in two flavours: <FONT COLOR=maroon><I><TT>label</TT></I></FONT> for normal arguments and
<FONT COLOR=maroon><I><TT>optlabel</TT></I></FONT> for optional ones. They are simply distinguished by their
first character, either <TT>~</TT> or <TT>?</TT>.<BR>
<BR>
<H4 CLASS="subsubsection"><A NAME="xhtoc6"></A>Prefix and infix symbols</H4><BR>
<BR>
<DIV CLASS="center"><TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=right NOWRAP>
<A NAME="infix-symbol"></A>
<FONT COLOR=maroon><I><TT>infix-symbol</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
(<FONT COLOR=blue><TT>=</TT></FONT> ∣ <FONT COLOR=blue><TT><</TT></FONT> ∣ <FONT COLOR=blue><TT>></TT></FONT> ∣ <FONT COLOR=blue><TT>@</TT></FONT> ∣ <FONT COLOR=blue><TT>^</TT></FONT> ∣ <FONT COLOR=blue><TT>|</TT></FONT> ∣ <FONT COLOR=blue><TT>&</TT></FONT> ∣
<FONT COLOR=blue><TT>+</TT></FONT> ∣ <FONT COLOR=blue><TT>-</TT></FONT> ∣ <FONT COLOR=blue><TT>*</TT></FONT> ∣ <FONT COLOR=blue><TT>/</TT></FONT> ∣ <FONT COLOR=blue><TT>$</TT></FONT> ∣ <FONT COLOR=blue><TT>%</TT></FONT>) { <FONT COLOR=maroon><I><a href="#operator-char"><font color=maroon><TT>operator-char</TT></font></a></I></FONT> }</TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<A NAME="prefix-symbol"></A>
<FONT COLOR=maroon><I><TT>prefix-symbol</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
(<FONT COLOR=blue><TT>!</TT></FONT> ∣ <FONT COLOR=blue><TT>?</TT></FONT> ∣ <FONT COLOR=blue><TT>~</TT></FONT>) { <FONT COLOR=maroon><I><a href="#operator-char"><font color=maroon><TT>operator-char</TT></font></a></I></FONT> }</TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<A NAME="operator-char"></A>
<FONT COLOR=maroon><I><TT>operator-char</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
<FONT COLOR=blue><TT>!</TT></FONT> ∣ <FONT COLOR=blue><TT>$</TT></FONT> ∣ <FONT COLOR=blue><TT>%</TT></FONT> ∣ <FONT COLOR=blue><TT>&</TT></FONT> ∣ <FONT COLOR=blue><TT>*</TT></FONT> ∣ <FONT COLOR=blue><TT>+</TT></FONT> ∣ <FONT COLOR=blue><TT>-</TT></FONT> ∣ <FONT COLOR=blue><TT>.</TT></FONT> ∣
<FONT COLOR=blue><TT>/</TT></FONT> ∣ <FONT COLOR=blue><TT>:</TT></FONT> ∣ <FONT COLOR=blue><TT><</TT></FONT> ∣ <FONT COLOR=blue><TT>=</TT></FONT> ∣ <FONT COLOR=blue><TT>></TT></FONT> ∣ <FONT COLOR=blue><TT>?</TT></FONT> ∣ <FONT COLOR=blue><TT>@</TT></FONT> ∣
<FONT COLOR=blue><TT>^</TT></FONT> ∣ <FONT COLOR=blue><TT>|</TT></FONT> ∣ <FONT COLOR=blue><TT>~</TT></FONT></TD>
</TR></TABLE></DIV><BR>
<BR>
Sequences of “operator characters”, such as <TT><=></TT> or <TT>!!</TT>,
are read as a single token from the <FONT COLOR=maroon><I><TT>infix-symbol</TT></I></FONT> or <FONT COLOR=maroon><I><TT>prefix-symbol</TT></I></FONT>
class. These symbols are parsed as prefix and infix operators inside
expressions, but otherwise behave much as identifiers.
<BR>
<BR>
<H4 CLASS="subsubsection">Keywords</H4>
The identifiers below are reserved as keywords, and cannot be employed
otherwise:
<PRE CLASS="verbatim">
and as assert asr begin class
constraint do done downto else end
exception external false for fun function
functor if in include inherit initializer
land lazy let lor lsl lsr
lxor match method mod module mutable
new object of open or private
rec sig struct then to true
try type val virtual when while
with
</PRE>The following character sequences are also keywords:
<PRE CLASS="verbatim">
!= # & && ' ( ) * + , -
-. -> . .. : :: := :> ; ;; <
<- = > >] >} ? ?? [ [< [> [|
] _ ` { {< | |] } ~
</PRE>Note that the following identifiers are keywords of the Camlp4
extensions and should be avoided for compatibility reasons.
<PRE CLASS="verbatim">
parser << <: >> $ $$ $:
</PRE>
<H4 CLASS="subsubsection">Ambiguities</H4>
Lexical ambiguities are resolved according to the “longest match”
rule: when a character sequence can be decomposed into two tokens in
several different ways, the decomposition retained is the one with the
longest first token.<BR>
<BR>
<H4 CLASS="subsubsection"><A NAME="xhtoc7"></A>Line number directives</H4><BR>
<BR>
<DIV CLASS="center"><TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=right NOWRAP>
<A NAME="linenum-directive"></A>
<FONT COLOR=maroon><I><TT>linenum-directive</TT></I></FONT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
<FONT COLOR=blue><TT>#</TT></FONT> {<FONT COLOR=blue><TT>0</TT></FONT> … <FONT COLOR=blue><TT>9</TT></FONT>}<SUP>+</SUP></TD>
</TR>
<TR><TD ALIGN=right NOWRAP> </TD>
<TD ALIGN=right NOWRAP>∣</TD>
<TD ALIGN=left NOWRAP> <FONT COLOR=blue><TT>#</TT></FONT> {<FONT COLOR=blue><TT>0</TT></FONT> … <FONT COLOR=blue><TT>9</TT></FONT>}<SUP>+</SUP> <FONT COLOR=blue><TT>"</TT></FONT> { <FONT COLOR=maroon><I><a href="#string-character"><font color=maroon><TT>string-character</TT></font></a></I></FONT> } <FONT COLOR=blue><TT>"</TT></FONT></TD>
</TR></TABLE></DIV><BR>
<BR>
Preprocessors that generate Caml source code can insert line number
directives in their output so that error messages produced by the
compiler contain line numbers and file names referring to the source
file before preprocessing, instead of after preprocessing.
A line number directive is composed of a <TT>#</TT> (sharp sign), followed by
a positive integer (the source line number), optionally followed by a
character string (the source file name).
Line number directives are treated as blank characters during lexical
analysis.<BR>
<BR>
<BR>
<BR>
<HR>
<A HREF="manual008.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="manual010.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
|