mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 20:17:37 +00:00
3060 lines
201 KiB
HTML
3060 lines
201 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||
<HTML>
|
||
<HEAD>
|
||
<TITLE>ECMA Grammar</TITLE>
|
||
<LINK rel="stylesheet" href="styles.css">
|
||
</HEAD>
|
||
|
||
<BODY>
|
||
<H2>Types</H2>
|
||
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">Value</SPAN><BR>
|
||
= <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">nullValue</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">booleanValue</SPAN>: <SPAN class="type-name">Boolean</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">doubleValue</SPAN>: <SPAN class="type-name">Double</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">stringValue</SPAN>: <SPAN class="type-name">String</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">objectValue</SPAN>: <SPAN class="type-name">Object</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">ObjectOrNull</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN
|
||
class="field-name">nullObjectOrNull</SPAN>; <SPAN
|
||
class="field-name">objectObjectOrNull</SPAN>: <SPAN class="type-name">Object</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">Object</SPAN><BR>
|
||
= <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">tuple</SPAN> {<BR>
|
||
<SPAN
|
||
class="field-name">properties</SPAN>: <SPAN class="type-name">Property</SPAN>[]<SPAN
|
||
class="symbol"><EFBFBD></SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">typeofName</SPAN>: <SPAN class="type-name">String</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">prototype</SPAN>: <SPAN class="type-name">ObjectOrNull</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">get</SPAN>: <SPAN class="type-name">PropName</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">put</SPAN>: <SPAN class="type-name">PropName</SPAN> × <SPAN
|
||
class="type-name">Value</SPAN> <SPAN class="symbol"><EFBFBD></SPAN> <SPAN
|
||
class="type-name">VoidOrException</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">delete</SPAN>: <SPAN class="type-name">PropName</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">BooleanOrException</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">call</SPAN>: <SPAN
|
||
class="type-name">ObjectOrNull</SPAN> × <SPAN
|
||
class="type-name">Value</SPAN>[] <SPAN class="symbol"><EFBFBD></SPAN> <SPAN
|
||
class="type-name">ReferenceOrException</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">construct</SPAN>: <SPAN class="type-name">Value</SPAN>[] <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ObjectOrException</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">defaultValue</SPAN>: <SPAN
|
||
class="type-name">DefaultValueHint</SPAN> <SPAN class="symbol"><EFBFBD></SPAN> <SPAN
|
||
class="type-name">ValueOrException</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">DefaultValueHint</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">noHint</SPAN>; <SPAN
|
||
class="field-name">numberHint</SPAN>; <SPAN class="field-name">stringHint</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">Property</SPAN><BR>
|
||
= <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">tuple</SPAN> {<BR>
|
||
<SPAN
|
||
class="field-name">name</SPAN>: <SPAN class="type-name">String</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">readOnly</SPAN>: <SPAN class="type-name">Boolean</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">enumerable</SPAN>: <SPAN class="type-name">Boolean</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">permanent</SPAN>: <SPAN class="type-name">Boolean</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">value</SPAN>: <SPAN class="type-name">Value</SPAN><SPAN
|
||
class="symbol"><EFBFBD></SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">PropName</SPAN> = <SPAN class="type-name">String</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">Place</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">tuple</SPAN> {<SPAN class="field-name">base</SPAN>: <SPAN
|
||
class="type-name">Object</SPAN>; <SPAN class="field-name">property</SPAN>: <SPAN
|
||
class="type-name">PropName</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">Reference</SPAN><BR>
|
||
= <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN
|
||
class="field-name">valueReference</SPAN>: <SPAN class="type-name">Value</SPAN>; <SPAN
|
||
class="field-name">placeReference</SPAN>: <SPAN class="type-name">Place</SPAN>; <SPAN
|
||
class="field-name">virtualReference</SPAN>: <SPAN class="type-name">PropName</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">IntegerOrException</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">normal</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN>; <SPAN class="field-name">abrupt</SPAN>: <SPAN
|
||
class="type-name">Exception</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">VoidOrException</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">normal</SPAN>; <SPAN
|
||
class="field-name">abrupt</SPAN>: <SPAN class="type-name">Exception</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">BooleanOrException</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">normal</SPAN>: <SPAN
|
||
class="type-name">Boolean</SPAN>; <SPAN class="field-name">abrupt</SPAN>: <SPAN
|
||
class="type-name">Exception</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">DoubleOrException</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">normal</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN>; <SPAN class="field-name">abrupt</SPAN>: <SPAN
|
||
class="type-name">Exception</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">StringOrException</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">normal</SPAN>: <SPAN
|
||
class="type-name">String</SPAN>; <SPAN class="field-name">abrupt</SPAN>: <SPAN
|
||
class="type-name">Exception</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">ObjectOrException</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">normal</SPAN>: <SPAN
|
||
class="type-name">Object</SPAN>; <SPAN class="field-name">abrupt</SPAN>: <SPAN
|
||
class="type-name">Exception</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">ValueOrException</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">normal</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN>; <SPAN class="field-name">abrupt</SPAN>: <SPAN
|
||
class="type-name">Exception</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">ReferenceOrException</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">normal</SPAN>: <SPAN
|
||
class="type-name">Reference</SPAN>; <SPAN class="field-name">abrupt</SPAN>: <SPAN
|
||
class="type-name">Exception</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">ValueListOrException</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">normal</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN>[]; <SPAN class="field-name">abrupt</SPAN>: <SPAN
|
||
class="type-name">Exception</SPAN>}</SPAN></P>
|
||
|
||
<H2>Helper Functions</H2>
|
||
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">objectOrNullToValue</SPAN>(<SPAN
|
||
class="local-variable">o</SPAN>: <SPAN class="type-name">ObjectOrNull</SPAN>) : <SPAN
|
||
class="type-name">Value</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">o</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">nullObjectOrNull</SPAN>: <SPAN class="field-name">nullValue</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">objectObjectOrNull</SPAN>(<SPAN class="local-variable">obj</SPAN>: <SPAN
|
||
class="type-name">Object</SPAN>): <SPAN class="field-name">objectValue</SPAN> <SPAN
|
||
class="local-variable">obj</SPAN><BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">undefinedResult</SPAN> : <SPAN
|
||
class="type-name">ValueOrException</SPAN> = <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="field-name">undefinedValue</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">nullResult</SPAN> : <SPAN
|
||
class="type-name">ValueOrException</SPAN> = <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="field-name">nullValue</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">booleanResult</SPAN>(<SPAN
|
||
class="local-variable">b</SPAN>: <SPAN class="type-name">Boolean</SPAN>) : <SPAN
|
||
class="type-name">ValueOrException</SPAN> = <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="field-name">booleanValue</SPAN> <SPAN
|
||
class="local-variable">b</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">doubleResult</SPAN>(<SPAN
|
||
class="local-variable">d</SPAN>: <SPAN class="type-name">Double</SPAN>) : <SPAN
|
||
class="type-name">ValueOrException</SPAN> = <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="field-name">doubleValue</SPAN> <SPAN
|
||
class="local-variable">d</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">integerResult</SPAN>(<SPAN
|
||
class="local-variable">i</SPAN>: <SPAN class="type-name">Integer</SPAN>) : <SPAN
|
||
class="type-name">ValueOrException</SPAN> = <SPAN
|
||
class="global-variable">doubleResult</SPAN>(<SPAN
|
||
class="global-variable">rationalToDouble</SPAN>(<SPAN class="local-variable">i</SPAN>))</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">stringResult</SPAN>(<SPAN
|
||
class="local-variable">s</SPAN>: <SPAN class="type-name">String</SPAN>) : <SPAN
|
||
class="type-name">ValueOrException</SPAN> = <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="field-name">stringValue</SPAN> <SPAN
|
||
class="local-variable">s</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">objectResult</SPAN>(<SPAN
|
||
class="local-variable">o</SPAN>: <SPAN class="type-name">Object</SPAN>) : <SPAN
|
||
class="type-name">ValueOrException</SPAN> = <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="field-name">objectValue</SPAN> <SPAN
|
||
class="local-variable">o</SPAN></P>
|
||
|
||
<H2>Exceptions</H2>
|
||
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">Exception</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<SPAN class="field-name">exception</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN>; <SPAN class="field-name">error</SPAN>: <SPAN
|
||
class="type-name">Error</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">Error</SPAN><BR>
|
||
= <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">oneof</SPAN> {<BR>
|
||
<SPAN
|
||
class="field-name">coerceToPrimitiveError</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">coerceToObjectError</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">getValueError</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">putValueError</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">deleteError</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">makeError</SPAN>(<SPAN
|
||
class="local-variable">err</SPAN>: <SPAN class="type-name">Error</SPAN>) : <SPAN
|
||
class="type-name">Exception</SPAN> = <SPAN class="field-name">error</SPAN> <SPAN
|
||
class="local-variable">err</SPAN></P>
|
||
|
||
<H2>Objects</H2>
|
||
|
||
<H2>Conversions</H2>
|
||
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">referenceGetValue</SPAN>(<SPAN
|
||
class="local-variable">rv</SPAN>: <SPAN class="type-name">Reference</SPAN>) : <SPAN
|
||
class="type-name">ValueOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">rv</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN class="field-name">valueReference</SPAN>(<SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN>): <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="local-variable">v</SPAN>;<BR>
|
||
<SPAN class="field-name">placeReference</SPAN>(<SPAN
|
||
class="local-variable">r</SPAN>: <SPAN class="type-name">Place</SPAN>): <SPAN
|
||
class="local-variable">r</SPAN>.<SPAN class="field-name">base</SPAN>.<SPAN
|
||
class="field-name">get</SPAN>(<SPAN class="local-variable">r</SPAN>.<SPAN
|
||
class="field-name">property</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">virtualReference</SPAN>: <SPAN class="field-name">abrupt</SPAN><SUB><SPAN
|
||
class="type-name">ValueOrException</SPAN></SUB> <SPAN
|
||
class="global-variable">makeError</SPAN>(<SPAN class="field-name">getValueError</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">referencePutValue</SPAN>(<SPAN
|
||
class="local-variable">rv</SPAN>: <SPAN class="type-name">Reference</SPAN>, <SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN>) : <SPAN
|
||
class="type-name">VoidOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">rv</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">valueReference</SPAN>: <SPAN class="field-name">abrupt</SPAN><SUB><SPAN
|
||
class="type-name">VoidOrException</SPAN></SUB> <SPAN
|
||
class="global-variable">makeError</SPAN>(<SPAN class="field-name">putValueError</SPAN>);<BR>
|
||
<SPAN class="field-name">placeReference</SPAN>(<SPAN
|
||
class="local-variable">r</SPAN>: <SPAN class="type-name">Place</SPAN>): <SPAN
|
||
class="local-variable">r</SPAN>.<SPAN class="field-name">base</SPAN>.<SPAN
|
||
class="field-name">put</SPAN>(<SPAN class="local-variable">r</SPAN>.<SPAN
|
||
class="field-name">property</SPAN>, <SPAN class="local-variable">v</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">virtualReference</SPAN>: <SPAN class="symbol">^</SPAN><BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<H2>Coercions</H2>
|
||
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">coerceToBoolean</SPAN>(<SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN>) : <SPAN
|
||
class="type-name">Boolean</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">v</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>: <SPAN
|
||
class="global-variable">false</SPAN>;<BR>
|
||
<SPAN class="field-name">booleanValue</SPAN>(<SPAN
|
||
class="local-variable">b</SPAN>: <SPAN class="type-name">Boolean</SPAN>): <SPAN
|
||
class="local-variable">b</SPAN>;<BR>
|
||
<SPAN class="field-name">doubleValue</SPAN>(<SPAN
|
||
class="local-variable">d</SPAN>: <SPAN class="type-name">Double</SPAN>): <SPAN
|
||
class="semantic-keyword">not</SPAN> (<SPAN class="global-variable">doubleIsZero</SPAN>(<SPAN
|
||
class="local-variable">d</SPAN>) <SPAN class="semantic-keyword">or</SPAN> <SPAN
|
||
class="global-variable">doubleIsNan</SPAN>(<SPAN class="local-variable">d</SPAN>));<BR>
|
||
<SPAN class="field-name">stringValue</SPAN>(<SPAN
|
||
class="local-variable">s</SPAN>: <SPAN class="type-name">String</SPAN>): <SPAN
|
||
class="global-variable">length</SPAN>(<SPAN
|
||
class="local-variable">s</SPAN>) ≠ 0;<BR>
|
||
<SPAN
|
||
class="field-name">objectValue</SPAN>: <SPAN class="global-variable">true</SPAN><BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">coerceBooleanToDouble</SPAN>(<SPAN
|
||
class="local-variable">b</SPAN>: <SPAN class="type-name">Boolean</SPAN>) : <SPAN
|
||
class="type-name">Double</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">if</SPAN> <SPAN
|
||
class="local-variable">b</SPAN><BR>
|
||
<SPAN class="semantic-keyword">then</SPAN> 1.0<BR>
|
||
<SPAN class="semantic-keyword">else</SPAN> 0.0</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">coerceToDouble</SPAN>(<SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN>) : <SPAN
|
||
class="type-name">DoubleOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">v</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>: <SPAN class="field-name">normal</SPAN> NaN;<BR>
|
||
<SPAN
|
||
class="field-name">nullValue</SPAN>: <SPAN class="field-name">normal</SPAN> 0.0;<BR>
|
||
<SPAN class="field-name">booleanValue</SPAN>(<SPAN
|
||
class="local-variable">b</SPAN>: <SPAN class="type-name">Boolean</SPAN>): <SPAN
|
||
class="field-name">normal</SPAN> <SPAN
|
||
class="global-variable">coerceBooleanToDouble</SPAN>(<SPAN class="local-variable">b</SPAN>);<BR>
|
||
<SPAN class="field-name">doubleValue</SPAN>(<SPAN
|
||
class="local-variable">d</SPAN>: <SPAN class="type-name">Double</SPAN>): <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="local-variable">d</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">stringValue</SPAN>: <SPAN class="symbol">^</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">objectValue</SPAN>: <SPAN class="symbol">^</SPAN><BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">coerceToUint32</SPAN>(<SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN>) : <SPAN
|
||
class="type-name">IntegerOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">d</SPAN>: <SPAN class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">v</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="global-variable">doubleToUint32</SPAN>(<SPAN
|
||
class="local-variable">d</SPAN>)</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">coerceToInt32</SPAN>(<SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN>) : <SPAN
|
||
class="type-name">IntegerOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">d</SPAN>: <SPAN class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">v</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="global-variable">uint32ToInt32</SPAN>(<SPAN
|
||
class="global-variable">doubleToUint32</SPAN>(<SPAN class="local-variable">d</SPAN>))</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">uint32ToInt32</SPAN>(<SPAN
|
||
class="local-variable">ui</SPAN>: <SPAN class="type-name">Integer</SPAN>) : <SPAN
|
||
class="type-name">Integer</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">if</SPAN> <SPAN
|
||
class="local-variable">ui</SPAN> < 2147483648<BR>
|
||
<SPAN class="semantic-keyword">then</SPAN> <SPAN
|
||
class="local-variable">ui</SPAN><BR>
|
||
<SPAN class="semantic-keyword">else</SPAN> <SPAN
|
||
class="local-variable">ui</SPAN> - 4294967296</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">coerceToString</SPAN>(<SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN>) : <SPAN
|
||
class="type-name">StringOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">v</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>: <SPAN
|
||
class="field-name">normal</SPAN> “<CODE>undefined</CODE>”;<BR>
|
||
<SPAN
|
||
class="field-name">nullValue</SPAN>: <SPAN
|
||
class="field-name">normal</SPAN> “<CODE>null</CODE>”;<BR>
|
||
<SPAN class="field-name">booleanValue</SPAN>(<SPAN
|
||
class="local-variable">b</SPAN>: <SPAN class="type-name">Boolean</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">if</SPAN> <SPAN class="local-variable">b</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">then</SPAN> <SPAN
|
||
class="field-name">normal</SPAN> “<CODE>true</CODE>”<BR>
|
||
<SPAN
|
||
class="semantic-keyword">else</SPAN> <SPAN
|
||
class="field-name">normal</SPAN> “<CODE>false</CODE>”;<BR>
|
||
<SPAN
|
||
class="field-name">doubleValue</SPAN>: <SPAN class="symbol">^</SPAN>;<BR>
|
||
<SPAN class="field-name">stringValue</SPAN>(<SPAN
|
||
class="local-variable">s</SPAN>: <SPAN class="type-name">String</SPAN>): <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="local-variable">s</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">objectValue</SPAN>: <SPAN class="symbol">^</SPAN><BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">coerceToPrimitive</SPAN>(<SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN>, <SPAN
|
||
class="local-variable">hint</SPAN>: <SPAN
|
||
class="type-name">DefaultValueHint</SPAN>) : <SPAN
|
||
class="type-name">ValueOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">v</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>, <SPAN
|
||
class="field-name">booleanValue</SPAN>, <SPAN class="field-name">doubleValue</SPAN>, <SPAN
|
||
class="field-name">stringValue</SPAN>: <SPAN class="field-name">normal</SPAN> <SPAN
|
||
class="local-variable">v</SPAN>;<BR>
|
||
<SPAN class="field-name">objectValue</SPAN>(<SPAN
|
||
class="local-variable">o</SPAN>: <SPAN class="type-name">Object</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">pv</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="local-variable">o</SPAN>.<SPAN
|
||
class="field-name">defaultValue</SPAN>(<SPAN class="local-variable">hint</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">pv</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>, <SPAN
|
||
class="field-name">booleanValue</SPAN>, <SPAN class="field-name">doubleValue</SPAN>, <SPAN
|
||
class="field-name">stringValue</SPAN>:<BR>
|
||
<SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="local-variable">pv</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">objectValue</SPAN>: <SPAN class="field-name">abrupt</SPAN><SUB><SPAN
|
||
class="type-name">ValueOrException</SPAN></SUB> <SPAN
|
||
class="global-variable">makeError</SPAN>(<SPAN class="field-name">coerceToPrimitiveError</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN><BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">coerceToObject</SPAN>(<SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN>) : <SPAN
|
||
class="type-name">ObjectOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">v</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>: <SPAN
|
||
class="field-name">abrupt</SPAN><SUB><SPAN
|
||
class="type-name">ObjectOrException</SPAN></SUB> <SPAN
|
||
class="global-variable">makeError</SPAN>(<SPAN class="field-name">coerceToObjectError</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">booleanValue</SPAN>: <SPAN class="symbol">^</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">doubleValue</SPAN>: <SPAN class="symbol">^</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">stringValue</SPAN>: <SPAN class="symbol">^</SPAN>;<BR>
|
||
<SPAN class="field-name">objectValue</SPAN>(<SPAN
|
||
class="local-variable">o</SPAN>: <SPAN class="type-name">Object</SPAN>): <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="local-variable">o</SPAN><BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<H2>Environments</H2>
|
||
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
||
class="type-name">Env</SPAN> = <SPAN class="type-expression"><SPAN
|
||
class="semantic-keyword">tuple</SPAN> {<SPAN class="field-name">this</SPAN>: <SPAN
|
||
class="type-name">ObjectOrNull</SPAN>}</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">lookupIdentifier</SPAN>(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>, <SPAN
|
||
class="local-variable">id</SPAN>: <SPAN class="type-name">String</SPAN>) : <SPAN
|
||
class="type-name">ReferenceOrException</SPAN> = <SPAN class="symbol">^</SPAN></P>
|
||
|
||
<H2>Terminal Actions</H2>
|
||
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">EvalIdentifier</SPAN>[<SPAN
|
||
class="terminal">Identifier</SPAN>] : <SPAN class="type-name">String</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">EvalNumber</SPAN>[<SPAN class="terminal">Number</SPAN>] : <SPAN
|
||
class="type-name">Double</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">EvalString</SPAN>[<SPAN class="terminal">String</SPAN>] : <SPAN
|
||
class="type-name">String</SPAN></P>
|
||
|
||
<H2>Primary Expressions</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">PrimaryRvalue</VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <CODE class="terminal-keyword">this</CODE></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">null</CODE></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">true</CODE></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">false</CODE></DIV>
|
||
<DIV class="grammar-rhs">| <SPAN class="terminal">Number</SPAN></DIV>
|
||
<DIV class="grammar-rhs">| <SPAN class="terminal">String</SPAN></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">(</CODE> <VAR
|
||
class="nonterminal">CommaExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">)</CODE></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">PrimaryLvalue</VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <SPAN class="terminal">Identifier</SPAN></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">(</CODE> <VAR
|
||
class="nonterminal">Lvalue</VAR> <CODE class="terminal-keyword">)</CODE></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">PrimaryRvalue</VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PrimaryRvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <CODE
|
||
class="terminal-keyword">this</CODE>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>) = <SPAN class="field-name">normal</SPAN> <SPAN
|
||
class="global-variable">objectOrNullToValue</SPAN>(<SPAN class="local-variable">e</SPAN>.<SPAN
|
||
class="field-name">this</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PrimaryRvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <CODE
|
||
class="terminal-keyword">null</CODE>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>) = <SPAN class="global-variable">nullResult</SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PrimaryRvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <CODE
|
||
class="terminal-keyword">true</CODE>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>) = <SPAN class="global-variable">booleanResult</SPAN>(<SPAN
|
||
class="global-variable">true</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PrimaryRvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <CODE
|
||
class="terminal-keyword">false</CODE>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>) = <SPAN class="global-variable">booleanResult</SPAN>(<SPAN
|
||
class="global-variable">false</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PrimaryRvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <SPAN
|
||
class="terminal">Number</SPAN>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>) = <SPAN class="global-variable">doubleResult</SPAN>(<SPAN
|
||
class="action-name">EvalNumber</SPAN>[<SPAN class="terminal">Number</SPAN>])</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PrimaryRvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <SPAN
|
||
class="terminal">String</SPAN>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>) = <SPAN class="global-variable">stringResult</SPAN>(<SPAN
|
||
class="action-name">EvalString</SPAN>[<SPAN class="terminal">String</SPAN>])</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PrimaryRvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <CODE
|
||
class="terminal-keyword">(</CODE> <VAR class="nonterminal">CommaExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">)</CODE>] = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">CommaExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">PrimaryLvalue</VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ReferenceOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PrimaryLvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <SPAN
|
||
class="terminal">Identifier</SPAN>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="global-variable">lookupIdentifier</SPAN>(<SPAN
|
||
class="local-variable">e</SPAN>, <SPAN class="action-name">EvalIdentifier</SPAN>[<SPAN
|
||
class="terminal">Identifier</SPAN>])</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PrimaryLvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <CODE
|
||
class="terminal-keyword">(</CODE> <VAR class="nonterminal">Lvalue</VAR> <CODE
|
||
class="terminal-keyword">)</CODE>] = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Lvalue</VAR>]</P>
|
||
|
||
<H2>Left-Side Expressions</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-argument"><VAR class="nonterminal"><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></VAR> <SPAN class="symbol"><EFBFBD></SPAN> {<VAR
|
||
class="nonterminal"><SPAN class="nonterminal-attribute">anyValue</SPAN></VAR>, <VAR
|
||
class="nonterminal"><SPAN class="nonterminal-attribute">noLValue</SPAN></VAR>}</DIV>
|
||
<DIV class="grammar-argument"><VAR class="nonterminal"><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> {<VAR class="nonterminal"><SPAN
|
||
class="nonterminal-attribute">call</SPAN></VAR>, <VAR class="nonterminal"><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN></VAR>}</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">PrimaryLvalue</VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">[</CODE> <VAR class="nonterminal">Expression</VAR> <CODE
|
||
class="terminal-keyword">]</CODE></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">.</CODE> <SPAN class="terminal">Identifier</SPAN></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">Lvalue</VAR> <VAR
|
||
class="nonterminal">Arguments</VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP></VAR> <VAR
|
||
class="nonterminal">Arguments</VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">[</CODE> <VAR class="nonterminal">Expression</VAR> <CODE
|
||
class="terminal-keyword">]</CODE></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">.</CODE> <SPAN class="terminal">Identifier</SPAN></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">PrimaryRvalue</VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">new</CODE> <VAR
|
||
class="nonterminal">MemberExpression<SUP><SPAN class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <VAR
|
||
class="nonterminal">Arguments</VAR></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">PrimaryRvalue</VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">new</CODE> <VAR
|
||
class="nonterminal">MemberExpression<SUP><SPAN class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <VAR
|
||
class="nonterminal">Arguments</VAR></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">new</CODE> <VAR
|
||
class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">Arguments</VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <CODE class="terminal-keyword">(</CODE> <CODE
|
||
class="terminal-keyword">)</CODE></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">(</CODE> <VAR
|
||
class="nonterminal">ArgumentList</VAR> <CODE class="terminal-keyword">)</CODE></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">ArgumentList</VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">ArgumentList</VAR> <CODE
|
||
class="terminal-keyword">,</CODE> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">Lvalue</VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ReferenceOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN> <VAR
|
||
class="nonterminal">PrimaryLvalue</VAR>] = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PrimaryLvalue</VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN> <VAR
|
||
class="nonterminal">Lvalue</VAR> <VAR class="nonterminal">Arguments</VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">functionReference</SPAN>: <SPAN
|
||
class="type-name">Reference</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Lvalue</VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">function</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">referenceGetValue</SPAN>(<SPAN
|
||
class="local-variable">functionReference</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">arguments</SPAN>: <SPAN class="type-expression"><SPAN
|
||
class="type-name">Value</SPAN>[]</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Arguments</VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">let</SPAN> <SPAN class="local-variable">this</SPAN>: <SPAN
|
||
class="type-name">ObjectOrNull</SPAN><BR>
|
||
= <SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">functionReference</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">valueReference</SPAN>, <SPAN
|
||
class="field-name">virtualReference</SPAN>: <SPAN
|
||
class="field-name">nullObjectOrNull</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">placeReference</SPAN>(<SPAN class="local-variable">p</SPAN>: <SPAN
|
||
class="type-name">Place</SPAN>): <SPAN class="field-name">objectObjectOrNull</SPAN> <SPAN
|
||
class="local-variable">p</SPAN>.<SPAN class="field-name">base</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN><BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">callObject</SPAN>(<SPAN class="local-variable">function</SPAN>, <SPAN
|
||
class="local-variable">this</SPAN>, <SPAN class="local-variable">arguments</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN> <VAR
|
||
class="nonterminal">MemberExpression<SUP><SPAN class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP></VAR> <VAR
|
||
class="nonterminal">Arguments</VAR>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">function</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">arguments</SPAN>: <SPAN class="type-expression"><SPAN
|
||
class="type-name">Value</SPAN>[]</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Arguments</VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">callObject</SPAN>(<SPAN class="local-variable">function</SPAN>, <SPAN
|
||
class="field-name">nullObjectOrNull</SPAN>, <SPAN class="local-variable">arguments</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">[</CODE> <VAR class="nonterminal">Expression</VAR> <CODE
|
||
class="terminal-keyword">]</CODE>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">container</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">property</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Expression</VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">readProperty</SPAN>(<SPAN
|
||
class="local-variable">container</SPAN>, <SPAN class="local-variable">property</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">.</CODE> <SPAN class="terminal">Identifier</SPAN>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">container</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">readProperty</SPAN>(<SPAN
|
||
class="local-variable">container</SPAN>, <SPAN class="field-name">stringValue</SPAN> <SPAN
|
||
class="action-name">EvalIdentifier</SPAN>[<SPAN class="terminal">Identifier</SPAN>])</P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN>,<SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberExpression<SUP><SPAN class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">PrimaryRvalue</VAR>] = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">PrimaryRvalue</VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">ref</SPAN>: <SPAN class="type-name">Reference</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-argument">MemberExprKind</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">referenceGetValue</SPAN>(<SPAN class="local-variable">ref</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberExpression<SUP><SPAN class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">new</CODE> <VAR
|
||
class="nonterminal">MemberExpression<SUP><SPAN class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <VAR
|
||
class="nonterminal">Arguments</VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">constructor</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberExpression<SUP><SPAN class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">arguments</SPAN>: <SPAN class="type-expression"><SPAN
|
||
class="type-name">Value</SPAN>[]</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Arguments</VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">constructObject</SPAN>(<SPAN
|
||
class="local-variable">constructor</SPAN>, <SPAN class="local-variable">arguments</SPAN>)</P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberExpression<SUP><SPAN class="nonterminal-attribute">noCall</SPAN>,<SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">new</CODE> <VAR
|
||
class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">constructor</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">constructObject</SPAN>(<SPAN
|
||
class="local-variable">constructor</SPAN>, <B>[]</B><SUB><SPAN
|
||
class="type-name">Value</SPAN></SUB>)</P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">Arguments</VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueListOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Arguments</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <CODE
|
||
class="terminal-keyword">(</CODE> <CODE class="terminal-keyword">)</CODE>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>) = <SPAN
|
||
class="field-name">normal</SPAN> <B>[]</B><SUB><SPAN class="type-name">Value</SPAN></SUB></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Arguments</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <CODE
|
||
class="terminal-keyword">(</CODE> <VAR class="nonterminal">ArgumentList</VAR> <CODE
|
||
class="terminal-keyword">)</CODE>] = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ArgumentList</VAR>]</P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">ArgumentList</VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueListOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ArgumentList</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <VAR
|
||
class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">arg</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="field-name">normal</SPAN> <B>[</B><SPAN class="local-variable">arg</SPAN><B>]</B></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ArgumentList</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <VAR
|
||
class="nonterminal">ArgumentList<SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">,</CODE> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">args</SPAN>: <SPAN class="type-expression"><SPAN
|
||
class="type-name">Value</SPAN>[]</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ArgumentList<SUB>1</SUB></VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">arg</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="field-name">normal</SPAN> (<SPAN class="local-variable">args</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <B>[</B><SPAN class="local-variable">arg</SPAN><B>]</B>)</P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">Lvalue</VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ReferenceOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Lvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <VAR
|
||
class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN></SUP></VAR>] = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Lvalue</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <VAR
|
||
class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN></SUP></VAR>] = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MemberLvalue<SUP><SPAN
|
||
class="nonterminal-attribute">noCall</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">readProperty</SPAN>(<SPAN
|
||
class="local-variable">container</SPAN>: <SPAN class="type-name">Value</SPAN>, <SPAN
|
||
class="local-variable">property</SPAN>: <SPAN class="type-name">Value</SPAN>) : <SPAN
|
||
class="type-name">ReferenceOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">obj</SPAN>: <SPAN class="type-name">Object</SPAN> = <SPAN
|
||
class="global-variable">coerceToObject</SPAN>(<SPAN class="local-variable">container</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">name</SPAN>: <SPAN
|
||
class="type-name">PropName</SPAN> = <SPAN
|
||
class="global-variable">coerceToString</SPAN>(<SPAN class="local-variable">property</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="field-name">placeReference</SPAN> <B><SPAN
|
||
class="symbol"><EFBFBD></SPAN></B><SPAN class="local-variable">obj</SPAN>, <SPAN
|
||
class="local-variable">name</SPAN><B><SPAN class="symbol"><EFBFBD></SPAN></B><SUB><SPAN
|
||
class="type-name">Place</SPAN></SUB></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">callObject</SPAN>(<SPAN
|
||
class="local-variable">function</SPAN>: <SPAN class="type-name">Value</SPAN>, <SPAN
|
||
class="local-variable">this</SPAN>: <SPAN class="type-name">ObjectOrNull</SPAN>, <SPAN
|
||
class="local-variable">arguments</SPAN>: <SPAN class="type-expression"><SPAN
|
||
class="type-name">Value</SPAN>[]</SPAN>) : <SPAN
|
||
class="type-name">ReferenceOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">function</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>, <SPAN
|
||
class="field-name">booleanValue</SPAN>, <SPAN class="field-name">doubleValue</SPAN>, <SPAN
|
||
class="field-name">stringValue</SPAN>:<BR>
|
||
<SPAN
|
||
class="field-name">abrupt</SPAN><SUB><SPAN
|
||
class="type-name">ReferenceOrException</SPAN></SUB> <SPAN
|
||
class="global-variable">makeError</SPAN>(<SPAN class="field-name">coerceToObjectError</SPAN>);<BR>
|
||
<SPAN class="field-name">objectValue</SPAN>(<SPAN
|
||
class="local-variable">o</SPAN>: <SPAN class="type-name">Object</SPAN>): <SPAN
|
||
class="local-variable">o</SPAN>.<SPAN class="field-name">call</SPAN>(<SPAN
|
||
class="local-variable">this</SPAN>, <SPAN class="local-variable">arguments</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">constructObject</SPAN>(<SPAN
|
||
class="local-variable">constructor</SPAN>: <SPAN class="type-name">Value</SPAN>, <SPAN
|
||
class="local-variable">arguments</SPAN>: <SPAN class="type-expression"><SPAN
|
||
class="type-name">Value</SPAN>[]</SPAN>) : <SPAN
|
||
class="type-name">ValueOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">constructor</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>, <SPAN
|
||
class="field-name">booleanValue</SPAN>, <SPAN class="field-name">doubleValue</SPAN>, <SPAN
|
||
class="field-name">stringValue</SPAN>:<BR>
|
||
<SPAN
|
||
class="field-name">abrupt</SPAN><SUB><SPAN
|
||
class="type-name">ValueOrException</SPAN></SUB> <SPAN
|
||
class="global-variable">makeError</SPAN>(<SPAN class="field-name">coerceToObjectError</SPAN>);<BR>
|
||
<SPAN class="field-name">objectValue</SPAN>(<SPAN
|
||
class="local-variable">o</SPAN>: <SPAN class="type-name">Object</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">res</SPAN>: <SPAN
|
||
class="type-name">Object</SPAN> = <SPAN class="local-variable">o</SPAN>.<SPAN
|
||
class="field-name">construct</SPAN>(<SPAN class="local-variable">arguments</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="global-variable">objectResult</SPAN>(<SPAN
|
||
class="local-variable">res</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<H2>Postfix Expressions</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">PostfixExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">Lvalue</VAR> <CODE
|
||
class="terminal-keyword">++</CODE></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">Lvalue</VAR> <CODE
|
||
class="terminal-keyword">--</CODE></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">PostfixExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">Lvalue</VAR> <CODE
|
||
class="terminal-keyword">++</CODE></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">Lvalue</VAR> <CODE
|
||
class="terminal-keyword">--</CODE></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">PostfixExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PostfixExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">NewExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PostfixExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">MemberExpression<SUP><SPAN
|
||
class="nonterminal-attribute">call</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MemberExpression<SUP><SPAN class="nonterminal-attribute">call</SPAN>,<SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PostfixExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">Lvalue</VAR> <CODE
|
||
class="terminal-keyword">++</CODE>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandReference</SPAN>: <SPAN
|
||
class="type-name">Reference</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Lvalue</VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">referenceGetValue</SPAN>(<SPAN
|
||
class="local-variable">operandReference</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">operand</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">operandValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">u</SPAN>: <SPAN
|
||
class="type-name">Void</SPAN><BR>
|
||
= <SPAN
|
||
class="global-variable">referencePutValue</SPAN>(<SPAN
|
||
class="local-variable">operandReference</SPAN>, <SPAN
|
||
class="field-name">doubleValue</SPAN> <SPAN class="global-variable">doubleAdd</SPAN>(<SPAN
|
||
class="local-variable">operand</SPAN>, 1.0))<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">doubleResult</SPAN>(<SPAN class="local-variable">operand</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PostfixExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">Lvalue</VAR> <CODE
|
||
class="terminal-keyword">--</CODE>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandReference</SPAN>: <SPAN
|
||
class="type-name">Reference</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Lvalue</VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">referenceGetValue</SPAN>(<SPAN
|
||
class="local-variable">operandReference</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">operand</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">operandValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">u</SPAN>: <SPAN
|
||
class="type-name">Void</SPAN><BR>
|
||
= <SPAN
|
||
class="global-variable">referencePutValue</SPAN>(<SPAN
|
||
class="local-variable">operandReference</SPAN>, <SPAN
|
||
class="field-name">doubleValue</SPAN> <SPAN class="global-variable">doubleSubtract</SPAN>(<SPAN
|
||
class="local-variable">operand</SPAN>, 1.0))<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">doubleResult</SPAN>(<SPAN class="local-variable">operand</SPAN>)</P>
|
||
|
||
<H2>Unary Operators</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">PostfixExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">delete</CODE> <VAR
|
||
class="nonterminal">Lvalue</VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">void</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">typeof</CODE> <VAR
|
||
class="nonterminal">Lvalue</VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">typeof</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">++</CODE> <VAR
|
||
class="nonterminal">Lvalue</VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">--</CODE> <VAR
|
||
class="nonterminal">Lvalue</VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">+</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">-</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">~</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <CODE class="terminal-keyword">!</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">PostfixExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">PostfixExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">delete</CODE> <VAR
|
||
class="nonterminal">Lvalue</VAR>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rv</SPAN>: <SPAN class="type-name">Reference</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">Lvalue</VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN class="local-variable">rv</SPAN> <SPAN
|
||
class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">valueReference</SPAN>: <SPAN class="field-name">abrupt</SPAN><SUB><SPAN
|
||
class="type-name">ValueOrException</SPAN></SUB> <SPAN
|
||
class="global-variable">makeError</SPAN>(<SPAN class="field-name">deleteError</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">placeReference</SPAN>(<SPAN class="local-variable">r</SPAN>: <SPAN
|
||
class="type-name">Place</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">b</SPAN>: <SPAN
|
||
class="type-name">Boolean</SPAN> = <SPAN class="local-variable">r</SPAN>.<SPAN
|
||
class="field-name">base</SPAN>.<SPAN class="field-name">delete</SPAN>(<SPAN
|
||
class="local-variable">r</SPAN>.<SPAN class="field-name">property</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="global-variable">booleanResult</SPAN>(<SPAN
|
||
class="local-variable">b</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">virtualReference</SPAN>: <SPAN
|
||
class="global-variable">booleanResult</SPAN>(<SPAN class="global-variable">true</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">void</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operand</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">undefinedResult</SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">typeof</CODE> <VAR
|
||
class="nonterminal">Lvalue</VAR>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rv</SPAN>: <SPAN class="type-name">Reference</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">Lvalue</VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN class="local-variable">rv</SPAN> <SPAN
|
||
class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">valueReference</SPAN>(<SPAN class="local-variable">v</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN>): <SPAN class="global-variable">stringResult</SPAN>(<SPAN
|
||
class="global-variable">valueTypeof</SPAN>(<SPAN class="local-variable">v</SPAN>));<BR>
|
||
<SPAN
|
||
class="field-name">placeReference</SPAN>(<SPAN class="local-variable">r</SPAN>: <SPAN
|
||
class="type-name">Place</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">v</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="local-variable">r</SPAN>.<SPAN
|
||
class="field-name">base</SPAN>.<SPAN class="field-name">get</SPAN>(<SPAN
|
||
class="local-variable">r</SPAN>.<SPAN class="field-name">property</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="global-variable">stringResult</SPAN>(<SPAN
|
||
class="global-variable">valueTypeof</SPAN>(<SPAN class="local-variable">v</SPAN>));<BR>
|
||
<SPAN
|
||
class="field-name">virtualReference</SPAN>: <SPAN
|
||
class="global-variable">stringResult</SPAN>(“<CODE>undefined</CODE>”)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">typeof</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">noLValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">stringResult</SPAN>(<SPAN class="global-variable">valueTypeof</SPAN>(<SPAN
|
||
class="local-variable">v</SPAN>))</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">++</CODE> <VAR
|
||
class="nonterminal">Lvalue</VAR>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandReference</SPAN>: <SPAN
|
||
class="type-name">Reference</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Lvalue</VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">referenceGetValue</SPAN>(<SPAN
|
||
class="local-variable">operandReference</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">operand</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">operandValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">let</SPAN> <SPAN class="local-variable">res</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN class="global-variable">doubleAdd</SPAN>(<SPAN
|
||
class="local-variable">operand</SPAN>, 1.0)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">u</SPAN>: <SPAN
|
||
class="type-name">Void</SPAN> = <SPAN
|
||
class="global-variable">referencePutValue</SPAN>(<SPAN
|
||
class="local-variable">operandReference</SPAN>, <SPAN
|
||
class="field-name">doubleValue</SPAN> <SPAN class="local-variable">res</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">doubleResult</SPAN>(<SPAN class="local-variable">res</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">--</CODE> <VAR
|
||
class="nonterminal">Lvalue</VAR>](<SPAN class="local-variable">e</SPAN>: <SPAN
|
||
class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandReference</SPAN>: <SPAN
|
||
class="type-name">Reference</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Lvalue</VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">referenceGetValue</SPAN>(<SPAN
|
||
class="local-variable">operandReference</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">operand</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">operandValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">let</SPAN> <SPAN class="local-variable">res</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">doubleSubtract</SPAN>(<SPAN
|
||
class="local-variable">operand</SPAN>, 1.0)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">u</SPAN>: <SPAN
|
||
class="type-name">Void</SPAN> = <SPAN
|
||
class="global-variable">referencePutValue</SPAN>(<SPAN
|
||
class="local-variable">operandReference</SPAN>, <SPAN
|
||
class="field-name">doubleValue</SPAN> <SPAN class="local-variable">res</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">doubleResult</SPAN>(<SPAN class="local-variable">res</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">+</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">operand</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">operandValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">doubleResult</SPAN>(<SPAN class="local-variable">operand</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">-</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">operand</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">operandValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">doubleResult</SPAN>(<SPAN class="global-variable">doubleNegate</SPAN>(<SPAN
|
||
class="local-variable">operand</SPAN>))</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">~</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">operand</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">coerceToInt32</SPAN>(<SPAN class="local-variable">operandValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">integerResult</SPAN>(<SPAN class="global-variable">bitwiseXor</SPAN>(<SPAN
|
||
class="local-variable">operand</SPAN>, -1))</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <CODE class="terminal-keyword">!</CODE> <VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">operandValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">booleanResult</SPAN>(<SPAN class="semantic-keyword">not</SPAN> <SPAN
|
||
class="global-variable">coerceToBoolean</SPAN>(<SPAN
|
||
class="local-variable">operandValue</SPAN>))</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">valueTypeof</SPAN>(<SPAN
|
||
class="local-variable">v</SPAN>: <SPAN class="type-name">Value</SPAN>) : <SPAN
|
||
class="type-name">String</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">v</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>: “<CODE>undefined</CODE>”;<BR>
|
||
<SPAN
|
||
class="field-name">nullValue</SPAN>: “<CODE>object</CODE>”;<BR>
|
||
<SPAN
|
||
class="field-name">booleanValue</SPAN>: “<CODE>boolean</CODE>”;<BR>
|
||
<SPAN
|
||
class="field-name">doubleValue</SPAN>: “<CODE>number</CODE>”;<BR>
|
||
<SPAN
|
||
class="field-name">stringValue</SPAN>: “<CODE>string</CODE>”;<BR>
|
||
<SPAN class="field-name">objectValue</SPAN>(<SPAN
|
||
class="local-variable">o</SPAN>: <SPAN class="type-name">Object</SPAN>): <SPAN
|
||
class="local-variable">o</SPAN>.<SPAN class="field-name">typeofName</SPAN><BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<H2>Multiplicative Operators</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">*</CODE> <VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">/</CODE> <VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">%</CODE> <VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">*</CODE> <VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">applyBinaryDoubleOperator</SPAN>(<SPAN
|
||
class="global-variable">doubleMultiply</SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">/</CODE> <VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">applyBinaryDoubleOperator</SPAN>(<SPAN
|
||
class="global-variable">doubleDivide</SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">%</CODE> <VAR class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">UnaryExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">applyBinaryDoubleOperator</SPAN>(<SPAN
|
||
class="global-variable">doubleRemainder</SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>)</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">applyBinaryDoubleOperator</SPAN>(<SPAN
|
||
class="local-variable">operator</SPAN>: <SPAN class="type-expression"><SPAN
|
||
class="type-name">Double</SPAN> × <SPAN class="type-name">Double</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">Double</SPAN></SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN>, <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN class="type-name">Value</SPAN>)<BR>
|
||
: <SPAN class="type-name">ValueOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftNumber</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">leftValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightNumber</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">rightValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">doubleResult</SPAN>(<SPAN class="local-variable">operator</SPAN>(<SPAN
|
||
class="local-variable">leftNumber</SPAN>, <SPAN class="local-variable">rightNumber</SPAN>))</P>
|
||
|
||
<H2>Additive Operators</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR
|
||
class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">+</CODE> <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">-</CODE> <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">+</CODE> <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftPrimitive</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">coerceToPrimitive</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="field-name">noHint</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightPrimitive</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">coerceToPrimitive</SPAN>(<SPAN
|
||
class="local-variable">rightValue</SPAN>, <SPAN class="field-name">noHint</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">if</SPAN> <SPAN class="local-variable">leftPrimitive</SPAN> <SPAN
|
||
class="semantic-keyword">is</SPAN> <SPAN class="field-name">stringValue</SPAN> <SPAN
|
||
class="semantic-keyword">or</SPAN> <SPAN
|
||
class="local-variable">rightPrimitive</SPAN> <SPAN
|
||
class="semantic-keyword">is</SPAN> <SPAN class="field-name">stringValue</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">then</SPAN> <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftString</SPAN>: <SPAN
|
||
class="type-name">String</SPAN> = <SPAN
|
||
class="global-variable">coerceToString</SPAN>(<SPAN class="local-variable">leftPrimitive</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightString</SPAN>: <SPAN
|
||
class="type-name">String</SPAN> = <SPAN
|
||
class="global-variable">coerceToString</SPAN>(<SPAN
|
||
class="local-variable">rightPrimitive</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="global-variable">stringResult</SPAN>(<SPAN
|
||
class="local-variable">leftString</SPAN> <SPAN class="symbol"><EFBFBD></SPAN> <SPAN
|
||
class="local-variable">rightString</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">else</SPAN> <SPAN
|
||
class="global-variable">applyBinaryDoubleOperator</SPAN>(<SPAN
|
||
class="global-variable">doubleAdd</SPAN>, <SPAN
|
||
class="local-variable">leftPrimitive</SPAN>, <SPAN
|
||
class="local-variable">rightPrimitive</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">-</CODE> <VAR class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">MultiplicativeExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">applyBinaryDoubleOperator</SPAN>(<SPAN
|
||
class="global-variable">doubleSubtract</SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>)</P>
|
||
|
||
<H2>Bitwise Shift Operators</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword"><<</CODE> <VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">>></CODE> <VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">>>></CODE> <VAR
|
||
class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword"><<</CODE> <VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">bitmapValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">countValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">bitmap</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">coerceToUint32</SPAN>(<SPAN class="local-variable">bitmapValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">count</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">coerceToUint32</SPAN>(<SPAN class="local-variable">countValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">integerResult</SPAN>(<BR>
|
||
<SPAN
|
||
class="global-variable">uint32ToInt32</SPAN>(<SPAN class="global-variable">bitwiseAnd</SPAN>(<SPAN
|
||
class="global-variable">bitwiseShift</SPAN>(<SPAN class="local-variable">bitmap</SPAN>, <SPAN
|
||
class="global-variable">bitwiseAnd</SPAN>(<SPAN
|
||
class="local-variable">count</SPAN>, 31)), 4294967295)))</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">>></CODE> <VAR class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">bitmapValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">countValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">bitmap</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">coerceToInt32</SPAN>(<SPAN class="local-variable">bitmapValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">count</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">coerceToUint32</SPAN>(<SPAN class="local-variable">countValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">integerResult</SPAN>(<SPAN class="global-variable">bitwiseShift</SPAN>(<SPAN
|
||
class="local-variable">bitmap</SPAN>, -<SPAN class="global-variable">bitwiseAnd</SPAN>(<SPAN
|
||
class="local-variable">count</SPAN>, 31)))</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">>>></CODE> <VAR
|
||
class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">bitmapValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">countValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AdditiveExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">bitmap</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">coerceToUint32</SPAN>(<SPAN class="local-variable">bitmapValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">count</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">coerceToUint32</SPAN>(<SPAN class="local-variable">countValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">integerResult</SPAN>(<SPAN class="global-variable">bitwiseShift</SPAN>(<SPAN
|
||
class="local-variable">bitmap</SPAN>, -<SPAN class="global-variable">bitwiseAnd</SPAN>(<SPAN
|
||
class="local-variable">count</SPAN>, 31)))</P>
|
||
|
||
<H2>Relational Operators</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword"><</CODE> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">></CODE> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword"><=</CODE> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">>=</CODE> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword"><</CODE> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">orderValues</SPAN>(<SPAN class="local-variable">leftValue</SPAN>, <SPAN
|
||
class="local-variable">rightValue</SPAN>, <SPAN class="global-variable">true</SPAN>, <SPAN
|
||
class="global-variable">false</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">></CODE> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">orderValues</SPAN>(<SPAN
|
||
class="local-variable">rightValue</SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="global-variable">true</SPAN>, <SPAN
|
||
class="global-variable">false</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword"><=</CODE> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">orderValues</SPAN>(<SPAN
|
||
class="local-variable">rightValue</SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="global-variable">false</SPAN>, <SPAN
|
||
class="global-variable">true</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">>=</CODE> <VAR class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ShiftExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">orderValues</SPAN>(<SPAN class="local-variable">leftValue</SPAN>, <SPAN
|
||
class="local-variable">rightValue</SPAN>, <SPAN
|
||
class="global-variable">false</SPAN>, <SPAN class="global-variable">true</SPAN>)</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">orderValues</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN>, <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN class="type-name">Value</SPAN>, <SPAN
|
||
class="local-variable">less</SPAN>: <SPAN class="type-name">Boolean</SPAN>, <SPAN
|
||
class="local-variable">greaterOrEqual</SPAN>: <SPAN class="type-name">Boolean</SPAN>)<BR>
|
||
: <SPAN class="type-name">ValueOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftPrimitive</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">coerceToPrimitive</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="field-name">numberHint</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightPrimitive</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">coerceToPrimitive</SPAN>(<SPAN
|
||
class="local-variable">rightValue</SPAN>, <SPAN class="field-name">numberHint</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">if</SPAN> <SPAN class="local-variable">leftPrimitive</SPAN> <SPAN
|
||
class="semantic-keyword">is</SPAN> <SPAN class="field-name">stringValue</SPAN> <SPAN
|
||
class="semantic-keyword">and</SPAN> <SPAN
|
||
class="local-variable">rightPrimitive</SPAN> <SPAN
|
||
class="semantic-keyword">is</SPAN> <SPAN class="field-name">stringValue</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">then</SPAN> <SPAN class="global-variable">booleanResult</SPAN>(<BR>
|
||
<SPAN
|
||
class="global-variable">compareStrings</SPAN>(<BR>
|
||
<SPAN
|
||
class="local-variable">leftPrimitive</SPAN>.<SPAN class="field-name">stringValue</SPAN>,<BR>
|
||
<SPAN
|
||
class="local-variable">rightPrimitive</SPAN>.<SPAN class="field-name">stringValue</SPAN>,<BR>
|
||
<SPAN
|
||
class="local-variable">less</SPAN>,<BR>
|
||
<SPAN
|
||
class="local-variable">greaterOrEqual</SPAN>,<BR>
|
||
<SPAN
|
||
class="local-variable">greaterOrEqual</SPAN>))<BR>
|
||
<SPAN
|
||
class="semantic-keyword">else</SPAN> <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftNumber</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">leftPrimitive</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightNumber</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN
|
||
class="local-variable">rightPrimitive</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="global-variable">booleanResult</SPAN>(<BR>
|
||
<SPAN
|
||
class="global-variable">doubleCompare</SPAN>(<BR>
|
||
<SPAN
|
||
class="local-variable">leftNumber</SPAN>,<BR>
|
||
<SPAN
|
||
class="local-variable">rightNumber</SPAN>,<BR>
|
||
<SPAN
|
||
class="local-variable">less</SPAN>,<BR>
|
||
<SPAN
|
||
class="local-variable">greaterOrEqual</SPAN>,<BR>
|
||
<SPAN
|
||
class="local-variable">greaterOrEqual</SPAN>,<BR>
|
||
<SPAN
|
||
class="global-variable">false</SPAN>))</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">compareStrings</SPAN>(<SPAN
|
||
class="local-variable">left</SPAN>: <SPAN class="type-name">String</SPAN>, <SPAN
|
||
class="local-variable">right</SPAN>: <SPAN class="type-name">String</SPAN>, <SPAN
|
||
class="local-variable">less</SPAN>: <SPAN class="type-name">Boolean</SPAN>, <SPAN
|
||
class="local-variable">equal</SPAN>: <SPAN class="type-name">Boolean</SPAN>, <SPAN
|
||
class="local-variable">greater</SPAN>: <SPAN class="type-name">Boolean</SPAN>)<BR>
|
||
: <SPAN class="type-name">Boolean</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">if</SPAN> <SPAN
|
||
class="global-variable">empty</SPAN>(<SPAN class="local-variable">left</SPAN>) <SPAN
|
||
class="semantic-keyword">and</SPAN> <SPAN class="global-variable">empty</SPAN>(<SPAN
|
||
class="local-variable">right</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">then</SPAN> <SPAN
|
||
class="local-variable">equal</SPAN><BR>
|
||
<SPAN class="semantic-keyword">else</SPAN> <SPAN
|
||
class="semantic-keyword">if</SPAN> <SPAN class="global-variable">empty</SPAN>(<SPAN
|
||
class="local-variable">left</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">then</SPAN> <SPAN
|
||
class="local-variable">less</SPAN><BR>
|
||
<SPAN class="semantic-keyword">else</SPAN> <SPAN
|
||
class="semantic-keyword">if</SPAN> <SPAN class="global-variable">empty</SPAN>(<SPAN
|
||
class="local-variable">right</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">then</SPAN> <SPAN
|
||
class="local-variable">greater</SPAN><BR>
|
||
<SPAN class="semantic-keyword">else</SPAN> <SPAN
|
||
class="semantic-keyword">let</SPAN> <SPAN
|
||
class="local-variable">leftCharCode</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">characterToCode</SPAN>(<SPAN class="global-variable">first</SPAN>(<SPAN
|
||
class="local-variable">left</SPAN>));<BR>
|
||
<SPAN
|
||
class="local-variable">rightCharCode</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">characterToCode</SPAN>(<SPAN class="global-variable">first</SPAN>(<SPAN
|
||
class="local-variable">right</SPAN>))<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="semantic-keyword">if</SPAN> <SPAN
|
||
class="local-variable">leftCharCode</SPAN> < <SPAN
|
||
class="local-variable">rightCharCode</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">then</SPAN> <SPAN class="local-variable">less</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">else</SPAN> <SPAN class="semantic-keyword">if</SPAN> <SPAN
|
||
class="local-variable">leftCharCode</SPAN> > <SPAN
|
||
class="local-variable">rightCharCode</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">then</SPAN> <SPAN class="local-variable">greater</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">else</SPAN> <SPAN class="global-variable">compareStrings</SPAN>(<SPAN
|
||
class="global-variable">rest</SPAN>(<SPAN class="local-variable">left</SPAN>), <SPAN
|
||
class="global-variable">rest</SPAN>(<SPAN class="local-variable">right</SPAN>), <SPAN
|
||
class="local-variable">less</SPAN>, <SPAN class="local-variable">equal</SPAN>, <SPAN
|
||
class="local-variable">greater</SPAN>)</P>
|
||
|
||
<H2>Equality Operators</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">==</CODE> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">!=</CODE> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">===</CODE> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">!==</CODE> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">==</CODE> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">eq</SPAN>: <SPAN
|
||
class="type-name">Boolean</SPAN> = <SPAN
|
||
class="global-variable">compareValues</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">booleanResult</SPAN>(<SPAN class="local-variable">eq</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">!=</CODE> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">eq</SPAN>: <SPAN
|
||
class="type-name">Boolean</SPAN> = <SPAN
|
||
class="global-variable">compareValues</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">booleanResult</SPAN>(<SPAN class="semantic-keyword">not</SPAN> <SPAN
|
||
class="local-variable">eq</SPAN>)</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">===</CODE> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">booleanResult</SPAN>(<SPAN
|
||
class="global-variable">strictCompareValues</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>))</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">!==</CODE> <VAR class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">RelationalExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">booleanResult</SPAN>(<SPAN class="semantic-keyword">not</SPAN> <SPAN
|
||
class="global-variable">strictCompareValues</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>))</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">compareValues</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN>, <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN>) : <SPAN class="type-name">BooleanOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>:<BR>
|
||
<SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN class="local-variable">rightValue</SPAN> <SPAN
|
||
class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>: <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="global-variable">true</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">booleanValue</SPAN>, <SPAN class="field-name">doubleValue</SPAN>, <SPAN
|
||
class="field-name">stringValue</SPAN>, <SPAN class="field-name">objectValue</SPAN>: <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="global-variable">false</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN>;<BR>
|
||
<SPAN class="field-name">booleanValue</SPAN>(<SPAN
|
||
class="local-variable">leftBool</SPAN>: <SPAN class="type-name">Boolean</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN class="local-variable">rightValue</SPAN> <SPAN
|
||
class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>: <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="global-variable">false</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">booleanValue</SPAN>(<SPAN class="local-variable">rightBool</SPAN>: <SPAN
|
||
class="type-name">Boolean</SPAN>): <SPAN class="field-name">normal</SPAN> (<SPAN
|
||
class="semantic-keyword">not</SPAN> (<SPAN class="local-variable">leftBool</SPAN> <SPAN
|
||
class="semantic-keyword">xor</SPAN> <SPAN class="local-variable">rightBool</SPAN>));<BR>
|
||
<SPAN
|
||
class="field-name">doubleValue</SPAN>, <SPAN class="field-name">stringValue</SPAN>, <SPAN
|
||
class="field-name">objectValue</SPAN>:<BR>
|
||
<SPAN
|
||
class="global-variable">compareDoubleToValue</SPAN>(<SPAN
|
||
class="global-variable">coerceBooleanToDouble</SPAN>(<SPAN
|
||
class="local-variable">leftBool</SPAN>), <SPAN class="local-variable">rightValue</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN>;<BR>
|
||
<SPAN class="field-name">doubleValue</SPAN>(<SPAN
|
||
class="local-variable">leftNumber</SPAN>: <SPAN class="type-name">Double</SPAN>): <SPAN
|
||
class="global-variable">compareDoubleToValue</SPAN>(<SPAN
|
||
class="local-variable">leftNumber</SPAN>, <SPAN class="local-variable">rightValue</SPAN>);<BR>
|
||
<SPAN class="field-name">stringValue</SPAN>(<SPAN
|
||
class="local-variable">leftStr</SPAN>: <SPAN class="type-name">String</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN class="local-variable">rightValue</SPAN> <SPAN
|
||
class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>: <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="global-variable">false</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">booleanValue</SPAN>(<SPAN class="local-variable">rightBool</SPAN>: <SPAN
|
||
class="type-name">Boolean</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftNumber</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">leftValue</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="field-name">normal</SPAN> <SPAN
|
||
class="global-variable">doubleEqual</SPAN>(<SPAN
|
||
class="local-variable">leftNumber</SPAN>, <SPAN
|
||
class="global-variable">coerceBooleanToDouble</SPAN>(<SPAN
|
||
class="local-variable">rightBool</SPAN>));<BR>
|
||
<SPAN
|
||
class="field-name">doubleValue</SPAN>(<SPAN class="local-variable">rightNumber</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftNumber</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">leftValue</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="field-name">normal</SPAN> <SPAN
|
||
class="global-variable">doubleEqual</SPAN>(<SPAN
|
||
class="local-variable">leftNumber</SPAN>, <SPAN class="local-variable">rightNumber</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">stringValue</SPAN>(<SPAN class="local-variable">rightStr</SPAN>: <SPAN
|
||
class="type-name">String</SPAN>):<BR>
|
||
<SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="global-variable">compareStrings</SPAN>(<SPAN
|
||
class="local-variable">leftStr</SPAN>, <SPAN class="local-variable">rightStr</SPAN>, <SPAN
|
||
class="global-variable">false</SPAN>, <SPAN class="global-variable">true</SPAN>, <SPAN
|
||
class="global-variable">false</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">objectValue</SPAN>:<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightPrimitive</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">coerceToPrimitive</SPAN>(<SPAN
|
||
class="local-variable">rightValue</SPAN>, <SPAN class="field-name">noHint</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="global-variable">compareValues</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN
|
||
class="local-variable">rightPrimitive</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN>;<BR>
|
||
<SPAN class="field-name">objectValue</SPAN>(<SPAN
|
||
class="local-variable">leftObj</SPAN>: <SPAN class="type-name">Object</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN class="local-variable">rightValue</SPAN> <SPAN
|
||
class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>: <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="global-variable">false</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">booleanValue</SPAN>(<SPAN class="local-variable">rightBool</SPAN>: <SPAN
|
||
class="type-name">Boolean</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftPrimitive</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">coerceToPrimitive</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="field-name">noHint</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="global-variable">compareValues</SPAN>(<BR>
|
||
<SPAN
|
||
class="local-variable">leftPrimitive</SPAN>,<BR>
|
||
<SPAN
|
||
class="field-name">doubleValue</SPAN> <SPAN
|
||
class="global-variable">coerceBooleanToDouble</SPAN>(<SPAN
|
||
class="local-variable">rightBool</SPAN>));<BR>
|
||
<SPAN
|
||
class="field-name">doubleValue</SPAN>, <SPAN class="field-name">stringValue</SPAN>:<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftPrimitive</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">coerceToPrimitive</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="field-name">noHint</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="global-variable">compareValues</SPAN>(<SPAN
|
||
class="local-variable">leftPrimitive</SPAN>, <SPAN
|
||
class="local-variable">rightValue</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">objectValue</SPAN>(<SPAN class="local-variable">rightObj</SPAN>: <SPAN
|
||
class="type-name">Object</SPAN>):<BR>
|
||
<SPAN
|
||
class="field-name">normal</SPAN> (<SPAN class="local-variable">leftObj</SPAN>.<SPAN
|
||
class="field-name">properties</SPAN> <SPAN class="symbol"><EFBFBD></SPAN> <SPAN
|
||
class="local-variable">rightObj</SPAN>.<SPAN class="field-name">properties</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN><BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">compareDoubleToValue</SPAN>(<SPAN
|
||
class="local-variable">leftNumber</SPAN>: <SPAN class="type-name">Double</SPAN>, <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN>) : <SPAN class="type-name">BooleanOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>: <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="global-variable">false</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">booleanValue</SPAN>, <SPAN class="field-name">doubleValue</SPAN>, <SPAN
|
||
class="field-name">stringValue</SPAN>:<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightNumber</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN> = <SPAN
|
||
class="global-variable">coerceToDouble</SPAN>(<SPAN class="local-variable">rightValue</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN class="field-name">normal</SPAN> <SPAN
|
||
class="global-variable">doubleEqual</SPAN>(<SPAN
|
||
class="local-variable">leftNumber</SPAN>, <SPAN class="local-variable">rightNumber</SPAN>);<BR>
|
||
<SPAN class="field-name">objectValue</SPAN>:<BR>
|
||
<SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightPrimitive</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN
|
||
class="global-variable">coerceToPrimitive</SPAN>(<SPAN
|
||
class="local-variable">rightValue</SPAN>, <SPAN class="field-name">noHint</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">compareDoubleToValue</SPAN>(<SPAN
|
||
class="local-variable">leftNumber</SPAN>, <SPAN
|
||
class="local-variable">rightPrimitive</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">doubleEqual</SPAN>(<SPAN
|
||
class="local-variable">x</SPAN>: <SPAN class="type-name">Double</SPAN>, <SPAN
|
||
class="local-variable">y</SPAN>: <SPAN class="type-name">Double</SPAN>) : <SPAN
|
||
class="type-name">Boolean</SPAN><BR>
|
||
= <SPAN class="global-variable">doubleCompare</SPAN>(<SPAN
|
||
class="local-variable">x</SPAN>, <SPAN class="local-variable">y</SPAN>, <SPAN
|
||
class="global-variable">false</SPAN>, <SPAN class="global-variable">true</SPAN>, <SPAN
|
||
class="global-variable">false</SPAN>, <SPAN class="global-variable">false</SPAN>)</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">strictCompareValues</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN>, <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN>) : <SPAN class="type-name">Boolean</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">case</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN> <SPAN class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>: <SPAN
|
||
class="local-variable">rightValue</SPAN> <SPAN class="semantic-keyword">is</SPAN> <SPAN
|
||
class="field-name">undefinedValue</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">nullValue</SPAN>: <SPAN class="local-variable">rightValue</SPAN> <SPAN
|
||
class="semantic-keyword">is</SPAN> <SPAN class="field-name">nullValue</SPAN>;<BR>
|
||
<SPAN class="field-name">booleanValue</SPAN>(<SPAN
|
||
class="local-variable">leftBool</SPAN>: <SPAN class="type-name">Boolean</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN class="local-variable">rightValue</SPAN> <SPAN
|
||
class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">booleanValue</SPAN>(<SPAN class="local-variable">rightBool</SPAN>: <SPAN
|
||
class="type-name">Boolean</SPAN>): <SPAN class="semantic-keyword">not</SPAN> (<SPAN
|
||
class="local-variable">leftBool</SPAN> <SPAN class="semantic-keyword">xor</SPAN> <SPAN
|
||
class="local-variable">rightBool</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>, <SPAN
|
||
class="field-name">doubleValue</SPAN>, <SPAN class="field-name">stringValue</SPAN>, <SPAN
|
||
class="field-name">objectValue</SPAN>: <SPAN class="global-variable">false</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN>;<BR>
|
||
<SPAN class="field-name">doubleValue</SPAN>(<SPAN
|
||
class="local-variable">leftNumber</SPAN>: <SPAN class="type-name">Double</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN class="local-variable">rightValue</SPAN> <SPAN
|
||
class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">doubleValue</SPAN>(<SPAN class="local-variable">rightNumber</SPAN>: <SPAN
|
||
class="type-name">Double</SPAN>): <SPAN class="global-variable">doubleEqual</SPAN>(<SPAN
|
||
class="local-variable">leftNumber</SPAN>, <SPAN class="local-variable">rightNumber</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>, <SPAN
|
||
class="field-name">booleanValue</SPAN>, <SPAN class="field-name">stringValue</SPAN>, <SPAN
|
||
class="field-name">objectValue</SPAN>: <SPAN class="global-variable">false</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN>;<BR>
|
||
<SPAN class="field-name">stringValue</SPAN>(<SPAN
|
||
class="local-variable">leftStr</SPAN>: <SPAN class="type-name">String</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN class="local-variable">rightValue</SPAN> <SPAN
|
||
class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">stringValue</SPAN>(<SPAN class="local-variable">rightStr</SPAN>: <SPAN
|
||
class="type-name">String</SPAN>):<BR>
|
||
<SPAN
|
||
class="global-variable">compareStrings</SPAN>(<SPAN
|
||
class="local-variable">leftStr</SPAN>, <SPAN class="local-variable">rightStr</SPAN>, <SPAN
|
||
class="global-variable">false</SPAN>, <SPAN class="global-variable">true</SPAN>, <SPAN
|
||
class="global-variable">false</SPAN>);<BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>, <SPAN
|
||
class="field-name">booleanValue</SPAN>, <SPAN class="field-name">doubleValue</SPAN>, <SPAN
|
||
class="field-name">objectValue</SPAN>: <SPAN class="global-variable">false</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN>;<BR>
|
||
<SPAN class="field-name">objectValue</SPAN>(<SPAN
|
||
class="local-variable">leftObj</SPAN>: <SPAN class="type-name">Object</SPAN>):<BR>
|
||
<SPAN
|
||
class="semantic-keyword">case</SPAN> <SPAN class="local-variable">rightValue</SPAN> <SPAN
|
||
class="semantic-keyword">of</SPAN><BR>
|
||
<SPAN
|
||
class="field-name">objectValue</SPAN>(<SPAN class="local-variable">rightObj</SPAN>: <SPAN
|
||
class="type-name">Object</SPAN>): <SPAN class="local-variable">leftObj</SPAN>.<SPAN
|
||
class="field-name">properties</SPAN> <SPAN class="symbol"><EFBFBD></SPAN> <SPAN
|
||
class="local-variable">rightObj</SPAN>.<SPAN class="field-name">properties</SPAN>;<BR>
|
||
<SPAN
|
||
class="field-name">undefinedValue</SPAN>, <SPAN class="field-name">nullValue</SPAN>, <SPAN
|
||
class="field-name">booleanValue</SPAN>, <SPAN class="field-name">doubleValue</SPAN>, <SPAN
|
||
class="field-name">stringValue</SPAN>: <SPAN class="global-variable">false</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">end</SPAN><BR>
|
||
<SPAN class="semantic-keyword">end</SPAN></P>
|
||
|
||
<H2>Binary Bitwise Operators</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">&</CODE> <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">^</CODE> <VAR class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">|</CODE> <VAR class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">&</CODE> <VAR class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">EqualityExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">applyBinaryBitwiseOperator</SPAN>(<SPAN
|
||
class="global-variable">bitwiseAnd</SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>)</P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">^</CODE> <VAR class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">applyBinaryBitwiseOperator</SPAN>(<SPAN
|
||
class="global-variable">bitwiseXor</SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>)</P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">|</CODE> <VAR class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseXorExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">applyBinaryBitwiseOperator</SPAN>(<SPAN
|
||
class="global-variable">bitwiseOr</SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>, <SPAN class="local-variable">rightValue</SPAN>)</P>
|
||
|
||
<P class="semantics"><SPAN class="global-variable">applyBinaryBitwiseOperator</SPAN>(<SPAN
|
||
class="local-variable">operator</SPAN>: <SPAN class="type-expression"><SPAN
|
||
class="type-name">Integer</SPAN> × <SPAN class="type-name">Integer</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">Integer</SPAN></SPAN>, <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN>, <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN class="type-name">Value</SPAN>)<BR>
|
||
: <SPAN class="type-name">ValueOrException</SPAN><BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftInt</SPAN>: <SPAN class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">coerceToInt32</SPAN>(<SPAN class="local-variable">leftValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">rightInt</SPAN>: <SPAN
|
||
class="type-name">Integer</SPAN> = <SPAN
|
||
class="global-variable">coerceToInt32</SPAN>(<SPAN class="local-variable">rightValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="global-variable">integerResult</SPAN>(<SPAN class="local-variable">operator</SPAN>(<SPAN
|
||
class="local-variable">leftInt</SPAN>, <SPAN class="local-variable">rightInt</SPAN>))</P>
|
||
|
||
<H2>Binary Logical Operators</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">&&</CODE> <VAR
|
||
class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">||</CODE> <VAR class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">&&</CODE> <VAR
|
||
class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">if</SPAN> <SPAN class="global-variable">coerceToBoolean</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">then</SPAN> <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">BitwiseOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">else</SPAN> <SPAN class="field-name">normal</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">||</CODE> <VAR class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">if</SPAN> <SPAN class="global-variable">coerceToBoolean</SPAN>(<SPAN
|
||
class="local-variable">leftValue</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">then</SPAN> <SPAN class="field-name">normal</SPAN> <SPAN
|
||
class="local-variable">leftValue</SPAN><BR>
|
||
<SPAN
|
||
class="semantic-keyword">else</SPAN> <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">LogicalAndExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)</P>
|
||
|
||
<H2>Conditional Operator</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">ConditionalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">?</CODE> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">:</CODE> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">ConditionalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ConditionalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ConditionalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR> <CODE
|
||
class="terminal-keyword">?</CODE> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR> <CODE
|
||
class="terminal-keyword">:</CODE> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>2</SUB></VAR>]<BR>
|
||
(<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">condition</SPAN>: <SPAN class="type-name">Value</SPAN> = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">LogicalOrExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">if</SPAN> <SPAN class="global-variable">coerceToBoolean</SPAN>(<SPAN
|
||
class="local-variable">condition</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">then</SPAN> <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN
|
||
class="semantic-keyword">else</SPAN> <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>2</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)</P>
|
||
|
||
<H2>Assignment Operators</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN class="symbol"><EFBFBD></SPAN></DIV>
|
||
<DIV class="grammar-rhs"> <VAR
|
||
class="nonterminal">ConditionalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
<DIV class="grammar-rhs">| <VAR class="nonterminal">Lvalue</VAR> <CODE
|
||
class="terminal-keyword">=</CODE> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H2>Expressions</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">CommaExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">ConditionalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">ConditionalExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">Lvalue</VAR> <CODE
|
||
class="terminal-keyword">=</CODE> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>: <SPAN class="type-name">Env</SPAN>)<BR>
|
||
= <SPAN class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">leftReference</SPAN>: <SPAN
|
||
class="type-name">Reference</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Lvalue</VAR>](<SPAN class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN
|
||
class="local-variable">rightValue</SPAN>: <SPAN
|
||
class="type-name">Value</SPAN> = <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP><SUB>1</SUB></VAR>](<SPAN
|
||
class="local-variable">e</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="semantic-keyword">letexc</SPAN> <SPAN class="local-variable">u</SPAN>: <SPAN
|
||
class="type-name">Void</SPAN> = <SPAN
|
||
class="global-variable">referencePutValue</SPAN>(<SPAN
|
||
class="local-variable">leftReference</SPAN>, <SPAN
|
||
class="local-variable">rightValue</SPAN>)<BR>
|
||
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
||
class="field-name">normal</SPAN> <SPAN class="local-variable">rightValue</SPAN></P>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">CommaExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">CommaExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]<BR>
|
||
= <SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">AssignmentExpression<SUP><SPAN
|
||
class="nonterminal-argument">ExprKind</SPAN></SUP></VAR>]</P>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">Expression</VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">CommaExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">Expression</VAR>] : <SPAN
|
||
class="type-expression"><SPAN class="type-name">Env</SPAN> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <SPAN class="type-name">ValueOrException</SPAN></SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Expression</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <VAR
|
||
class="nonterminal">CommaExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>] = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">CommaExpression<SUP><SPAN
|
||
class="nonterminal-attribute">anyValue</SPAN></SUP></VAR>]</P>
|
||
|
||
<H2>Programs</H2>
|
||
|
||
<H4>Syntax</H4>
|
||
|
||
<DIV class="grammar-rule">
|
||
<DIV class="grammar-lhs"><VAR class="nonterminal">Program</VAR> <SPAN
|
||
class="symbol"><EFBFBD></SPAN> <VAR class="nonterminal">Expression</VAR> <SPAN
|
||
class="terminal">End</SPAN></DIV>
|
||
</DIV>
|
||
<H4>Semantics</H4>
|
||
|
||
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">Program</VAR>] : <SPAN
|
||
class="type-name">ValueOrException</SPAN></P>
|
||
|
||
<P class="semantics-next"><SPAN class="action-name">Eval</SPAN>[<VAR
|
||
class="nonterminal">Program</VAR> <SPAN class="symbol"><EFBFBD></SPAN> <VAR
|
||
class="nonterminal">Expression</VAR> <SPAN class="terminal">End</SPAN>] = <SPAN
|
||
class="action-name">Eval</SPAN>[<VAR class="nonterminal">Expression</VAR>](<B><SPAN
|
||
class="symbol"><EFBFBD></SPAN></B><SPAN class="field-name">nullObjectOrNull</SPAN><B><SPAN
|
||
class="symbol"><EFBFBD></SPAN></B><SUB><SPAN class="type-name">Env</SPAN></SUB>)</P>
|
||
|
||
</BODY>
|
||
</HTML>
|