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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.8">
<title>Identifier</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">
<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css"/>
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20130715</a>
</div>
</div>
<div id="header">
<h1>Identifier</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p>In <a href="StandardML">Standard ML</a>, there are syntactically two kinds of
identifiers.</p></div>
<div class="ulist"><ul>
<li>
<p>
Alphanumeric: starts with a letter or prime (<span class="monospaced">'</span>) and is followed by letters, digits, primes and underbars (<span class="monospaced">_</span>).
</p>
<div class="paragraph"><p>Examples: <span class="monospaced">abc</span>, <span class="monospaced">ABC123</span>, <span class="monospaced">Abc_123</span>, <span class="monospaced">'a</span>.</p></div>
</li>
<li>
<p>
Symbolic: a sequence of the following
</p>
<div class="listingblock">
<div class="content monospaced">
<pre> ! % & $ # + - / : < = > ? @ | ~ ` ^ | *</pre>
</div></div>
<div class="paragraph"><p>Examples: <span class="monospaced">+=</span>, <span class="monospaced"><=</span>, <span class="monospaced">>></span>, <span class="monospaced">$</span>.</p></div>
</li>
</ul></div>
<div class="paragraph"><p>With the exception of <span class="monospaced">=</span>, reserved words can not be identifiers.</p></div>
<div class="paragraph"><p>There are a number of different classes of identifiers, some of which
have additional syntactic rules.</p></div>
<div class="ulist"><ul>
<li>
<p>
Identifiers not starting with a prime.
</p>
<div class="ulist"><ul>
<li>
<p>
value identifier (includes variables and constructors)
</p>
</li>
<li>
<p>
type constructor
</p>
</li>
<li>
<p>
structure identifier
</p>
</li>
<li>
<p>
signature identifier
</p>
</li>
<li>
<p>
functor identifier
</p>
</li>
</ul></div>
</li>
<li>
<p>
Identifiers starting with a prime.
</p>
<div class="ulist"><ul>
<li>
<p>
type variable
</p>
</li>
</ul></div>
</li>
<li>
<p>
Identifiers not starting with a prime and numeric labels (<span class="monospaced">1</span>, <span class="monospaced">2</span>, …).
</p>
<div class="ulist"><ul>
<li>
<p>
record label
</p>
</li>
</ul></div>
</li>
</ul></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
|