mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 20:17:37 +00:00
1414 lines
81 KiB
HTML
1414 lines
81 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 Lexer</TITLE>
|
|
<LINK rel="stylesheet" href="styles.css">
|
|
</HEAD>
|
|
|
|
<BODY>
|
|
<H2>Comments</H2>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">LineComment</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>/</CODE> <CODE>/</CODE> <VAR
|
|
class="nonterminal">LineCommentCharacters</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">LineCommentCharacters</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> «empty»</DIV>
|
|
<DIV class="grammar-rhs">| <VAR
|
|
class="nonterminal">LineCommentCharacters</VAR> <VAR
|
|
class="nonterminal">NonTerminator</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">NonTerminator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">AnyCharacter</VAR> <B>except</B> <VAR
|
|
class="nonterminal">LineTerminator</VAR></DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">SingleLineBlockComment</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>/</CODE> <CODE>*</CODE> <VAR
|
|
class="nonterminal">BlockCommentCharacters</VAR> <CODE>*</CODE> <CODE>/</CODE></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">BlockCommentCharacters</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> «empty»</DIV>
|
|
<DIV class="grammar-rhs">| <VAR
|
|
class="nonterminal">BlockCommentCharacters</VAR> <VAR
|
|
class="nonterminal">NonTerminatorOrSlash</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR
|
|
class="nonterminal">PreSlashCharacters</VAR> <CODE>/</CODE></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">PreSlashCharacters</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> «empty»</DIV>
|
|
<DIV class="grammar-rhs">| <VAR
|
|
class="nonterminal">BlockCommentCharacters</VAR> <VAR
|
|
class="nonterminal">NonTerminatorOrAsteriskOrSlash</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR
|
|
class="nonterminal">PreSlashCharacters</VAR> <CODE>/</CODE></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">NonTerminatorOrSlash</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">NonTerminator</VAR> <B>except</B> <CODE>/</CODE></DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">NonTerminatorOrAsteriskOrSlash</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">NonTerminator</VAR> <B>except</B> <CODE>*</CODE> | <CODE>/</CODE></DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">MultiLineBlockComment</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>/</CODE> <CODE>*</CODE> <VAR
|
|
class="nonterminal">MultiLineBlockCommentCharacters</VAR> <VAR
|
|
class="nonterminal">BlockCommentCharacters</VAR> <CODE>*</CODE> <CODE>/</CODE></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">MultiLineBlockCommentCharacters</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR
|
|
class="nonterminal">BlockCommentCharacters</VAR> <VAR
|
|
class="nonterminal">LineTerminator</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR
|
|
class="nonterminal">MultiLineBlockCommentCharacters</VAR> <VAR
|
|
class="nonterminal">BlockCommentCharacters</VAR> <VAR
|
|
class="nonterminal">LineTerminator</VAR></DIV>
|
|
</DIV>
|
|
<H2>White space</H2>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">WhiteSpace</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> «empty»</DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">WhiteSpace</VAR> <VAR
|
|
class="nonterminal">WhiteSpaceCharacter</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">WhiteSpace</VAR> <VAR
|
|
class="nonterminal">SingleLineBlockComment</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">WhiteSpaceCharacter</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE><SPAN
|
|
class="control">«TAB»</SPAN></CODE> | <CODE><SPAN
|
|
class="control">«VT»</SPAN></CODE> | <CODE><SPAN
|
|
class="control">«FF»</SPAN></CODE> | <CODE><SPAN
|
|
class="control">«SP»</SPAN></CODE></DIV>
|
|
<H2>Line breaks</H2>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">LineBreak</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">LineTerminator</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">LineComment</VAR> <VAR
|
|
class="nonterminal">LineTerminator</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">MultiLineBlockComment</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">LineTerminator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE><SPAN
|
|
class="control">«LF»</SPAN></CODE> | <CODE><SPAN
|
|
class="control">«CR»</SPAN></CODE></DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">LineBreaks</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">LineBreak</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">LineBreaks</VAR> <VAR
|
|
class="nonterminal">WhiteSpace</VAR> <VAR class="nonterminal">LineBreak</VAR></DIV>
|
|
</DIV>
|
|
<H2>Tokens</H2>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">NextToken</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <VAR class="nonterminal">WhiteSpace</VAR> <VAR
|
|
class="nonterminal">Token</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">Token</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">LineBreaks</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR
|
|
class="nonterminal">IdentifierOrReservedWord</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">Punctuator</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">NumericLiteral</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">StringLiteral</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">EndOfInput</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">EndOfInput</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <SPAN class="terminal">End</SPAN></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">LineComment</VAR> <SPAN
|
|
class="terminal">End</SPAN></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">type</SPAN> <SPAN
|
|
class="type-name">Token</SPAN><BR>
|
|
= <SPAN class="type-expression"><SPAN
|
|
class="semantic-keyword">oneof</SPAN> {<BR>
|
|
<SPAN
|
|
class="field-name">identifier</SPAN>: <SPAN class="type-name">String</SPAN>;<BR>
|
|
<SPAN
|
|
class="field-name">reservedWord</SPAN>: <SPAN class="type-name">String</SPAN>;<BR>
|
|
<SPAN
|
|
class="field-name">punctuator</SPAN>: <SPAN class="type-name">String</SPAN>;<BR>
|
|
<SPAN
|
|
class="field-name">number</SPAN>: <SPAN class="type-name">Double</SPAN>;<BR>
|
|
<SPAN
|
|
class="field-name">string</SPAN>: <SPAN class="type-name">String</SPAN>;<BR>
|
|
<SPAN
|
|
class="field-name">lineBreaks</SPAN>;<BR>
|
|
<SPAN
|
|
class="field-name">end</SPAN>}</SPAN></P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">Token</SPAN>[<VAR class="nonterminal">NextToken</VAR>] : <SPAN
|
|
class="type-name">Token</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Token</SPAN>[<VAR
|
|
class="nonterminal">NextToken</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">WhiteSpace</VAR> <VAR class="nonterminal">Token</VAR>] = <SPAN
|
|
class="action-name">Token</SPAN>[<VAR class="nonterminal">Token</VAR>]</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">Token</SPAN>[<VAR class="nonterminal">Token</VAR>] : <SPAN
|
|
class="type-name">Token</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Token</SPAN>[<VAR
|
|
class="nonterminal">Token</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">LineBreaks</VAR>] = <SPAN class="field-name">lineBreaks</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Token</SPAN>[<VAR
|
|
class="nonterminal">Token</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">IdentifierOrReservedWord</VAR>] = <SPAN
|
|
class="action-name">Token</SPAN>[<VAR class="nonterminal">IdentifierOrReservedWord</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Token</SPAN>[<VAR
|
|
class="nonterminal">Token</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">Punctuator</VAR>] = <SPAN
|
|
class="field-name">punctuator</SPAN> <SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Token</SPAN>[<VAR
|
|
class="nonterminal">Token</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">NumericLiteral</VAR>] = <SPAN
|
|
class="field-name">number</SPAN> <SPAN class="action-name">DoubleValue</SPAN>[<VAR
|
|
class="nonterminal">NumericLiteral</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Token</SPAN>[<VAR
|
|
class="nonterminal">Token</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">StringLiteral</VAR>] = <SPAN
|
|
class="field-name">string</SPAN> <SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">StringLiteral</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Token</SPAN>[<VAR
|
|
class="nonterminal">Token</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">EndOfInput</VAR>] = <SPAN class="field-name">end</SPAN></P>
|
|
|
|
<H2>Keywords</H2>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">IdentifierName</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">IdentifierLetter</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">IdentifierName</VAR> <VAR
|
|
class="nonterminal">IdentifierLetter</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">IdentifierName</VAR> <VAR
|
|
class="nonterminal">DecimalDigit</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">IdentifierLetter</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV
|
|
class="grammar-rhs"> <CODE>A</CODE> | <CODE>B</CODE> | <CODE>C</CODE> | <CODE>D</CODE> | <CODE>E</CODE> | <CODE>F</CODE> | <CODE>G</CODE> | <CODE>H</CODE> | <CODE>I</CODE> | <CODE>J</CODE> | <CODE>K</CODE> | <CODE>L</CODE> | <CODE>M</CODE> | <CODE>N</CODE> | <CODE>O</CODE> | <CODE>P</CODE> | <CODE>Q</CODE> | <CODE>R</CODE> | <CODE>S</CODE> | <CODE>T</CODE> | <CODE>U</CODE> | <CODE>V</CODE> | <CODE>W</CODE> | <CODE>X</CODE> | <CODE>Y</CODE> | <CODE>Z</CODE></DIV>
|
|
<DIV
|
|
class="grammar-rhs">| <CODE>a</CODE> | <CODE>b</CODE> | <CODE>c</CODE> | <CODE>d</CODE> | <CODE>e</CODE> | <CODE>f</CODE> | <CODE>g</CODE> | <CODE>h</CODE> | <CODE>i</CODE> | <CODE>j</CODE> | <CODE>k</CODE> | <CODE>l</CODE> | <CODE>m</CODE> | <CODE>n</CODE> | <CODE>o</CODE> | <CODE>p</CODE> | <CODE>q</CODE> | <CODE>r</CODE> | <CODE>s</CODE> | <CODE>t</CODE> | <CODE>u</CODE> | <CODE>v</CODE> | <CODE>w</CODE> | <CODE>x</CODE> | <CODE>y</CODE> | <CODE>z</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>$</CODE> | <CODE>_</CODE></DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">DecimalDigit</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>0</CODE> | <CODE>1</CODE> | <CODE>2</CODE> | <CODE>3</CODE> | <CODE>4</CODE> | <CODE>5</CODE> | <CODE>6</CODE> | <CODE>7</CODE> | <CODE>8</CODE> | <CODE>9</CODE></DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">Name</SPAN>[<VAR class="nonterminal">IdentifierName</VAR>] : <SPAN
|
|
class="type-name">String</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Name</SPAN>[<VAR
|
|
class="nonterminal">IdentifierName</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">IdentifierLetter</VAR>] = <B>[</B><SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">IdentifierLetter</VAR>]<B>]</B></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Name</SPAN>[<VAR
|
|
class="nonterminal">IdentifierName</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">IdentifierName<SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">IdentifierLetter</VAR>]<BR>
|
|
= <SPAN class="action-name">Name</SPAN>[<VAR
|
|
class="nonterminal">IdentifierName<SUB>1</SUB></VAR>] <SPAN
|
|
class="symbol">¨</SPAN> <B>[</B><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">IdentifierLetter</VAR>]<B>]</B></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Name</SPAN>[<VAR
|
|
class="nonterminal">IdentifierName</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">IdentifierName<SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">DecimalDigit</VAR>]<BR>
|
|
= <SPAN class="action-name">Name</SPAN>[<VAR
|
|
class="nonterminal">IdentifierName<SUB>1</SUB></VAR>] <SPAN
|
|
class="symbol">¨</SPAN> <B>[</B><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalDigit</VAR>]<B>]</B></P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">IdentifierLetter</VAR>] : <SPAN
|
|
class="type-name">Character</SPAN> = <VAR class="nonterminal">IdentifierLetter</VAR></P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalDigit</VAR>] : <SPAN
|
|
class="type-name">Character</SPAN> = <VAR class="nonterminal">DecimalDigit</VAR></P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">DigitValue</SPAN>[<VAR class="nonterminal">DecimalDigit</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN> = <SPAN class="global-variable">digitValue</SPAN>(<VAR
|
|
class="nonterminal">DecimalDigit</VAR>)</P>
|
|
|
|
<P class="semantics"><SPAN class="global-variable">keywords</SPAN> : <SPAN
|
|
class="type-expression"><SPAN class="type-name">String</SPAN>[]</SPAN><BR>
|
|
= <B>[</B>“<CODE>break</CODE>”,<BR>
|
|
“<CODE>case</CODE>”,<BR>
|
|
“<CODE>catch</CODE>”,<BR>
|
|
“<CODE>continue</CODE>”,<BR>
|
|
“<CODE>default</CODE>”,<BR>
|
|
“<CODE>delete</CODE>”,<BR>
|
|
“<CODE>do</CODE>”,<BR>
|
|
“<CODE>else</CODE>”,<BR>
|
|
“<CODE>finally</CODE>”,<BR>
|
|
“<CODE>for</CODE>”,<BR>
|
|
“<CODE>function</CODE>”,<BR>
|
|
“<CODE>if</CODE>”,<BR>
|
|
“<CODE>in</CODE>”,<BR>
|
|
“<CODE>new</CODE>”,<BR>
|
|
“<CODE>return</CODE>”,<BR>
|
|
“<CODE>switch</CODE>”,<BR>
|
|
“<CODE>this</CODE>”,<BR>
|
|
“<CODE>throw</CODE>”,<BR>
|
|
“<CODE>try</CODE>”,<BR>
|
|
“<CODE>typeof</CODE>”,<BR>
|
|
“<CODE>var</CODE>”,<BR>
|
|
“<CODE>void</CODE>”,<BR>
|
|
“<CODE>while</CODE>”,<BR>
|
|
“<CODE>with</CODE>”<B>]</B></P>
|
|
|
|
<P class="semantics"><SPAN class="global-variable">futureReservedWords</SPAN> : <SPAN
|
|
class="type-expression"><SPAN class="type-name">String</SPAN>[]</SPAN><BR>
|
|
= <B>[</B>“<CODE>class</CODE>”, “<CODE>const</CODE>”, “<CODE>debugger</CODE>”, “<CODE>enum</CODE>”, “<CODE>export</CODE>”, “<CODE>extends</CODE>”, “<CODE>import</CODE>”, “<CODE>super</CODE>”<B>]</B></P>
|
|
|
|
<P class="semantics"><SPAN class="global-variable">literals</SPAN> : <SPAN
|
|
class="type-expression"><SPAN
|
|
class="type-name">String</SPAN>[]</SPAN> = <B>[</B>“<CODE>null</CODE>”, “<CODE>true</CODE>”, “<CODE>false</CODE>”<B>]</B></P>
|
|
|
|
<P class="semantics"><SPAN class="global-variable">reservedWords</SPAN> : <SPAN
|
|
class="type-expression"><SPAN class="type-name">String</SPAN>[]</SPAN> = <SPAN
|
|
class="global-variable">keywords</SPAN> <SPAN class="symbol">¨</SPAN> <SPAN
|
|
class="global-variable">futureReservedWords</SPAN> <SPAN class="symbol">¨</SPAN> <SPAN
|
|
class="global-variable">literals</SPAN></P>
|
|
|
|
<P class="semantics"><SPAN class="global-variable">member</SPAN>(<SPAN
|
|
class="local-variable">id</SPAN>: <SPAN class="type-name">String</SPAN>, <SPAN
|
|
class="local-variable">list</SPAN>: <SPAN class="type-expression"><SPAN
|
|
class="type-name">String</SPAN>[]</SPAN>) : <SPAN class="type-name">Boolean</SPAN><BR>
|
|
= <SPAN class="semantic-keyword">if</SPAN> <SPAN
|
|
class="global-variable">empty</SPAN>(<SPAN class="local-variable">list</SPAN>)<BR>
|
|
<SPAN class="semantic-keyword">then</SPAN> <SPAN
|
|
class="global-variable">false</SPAN><BR>
|
|
<SPAN class="semantic-keyword">else</SPAN> <SPAN
|
|
class="semantic-keyword">let</SPAN> <SPAN class="local-variable">s</SPAN>: <SPAN
|
|
class="type-name">String</SPAN> = <SPAN class="global-variable">first</SPAN>(<SPAN
|
|
class="local-variable">list</SPAN>)<BR>
|
|
<SPAN
|
|
class="semantic-keyword">in</SPAN> <SPAN class="semantic-keyword">if</SPAN> <SPAN
|
|
class="global-variable">stringEqual</SPAN>(<SPAN class="local-variable">id</SPAN>, <SPAN
|
|
class="local-variable">s</SPAN>)<BR>
|
|
<SPAN
|
|
class="semantic-keyword">then</SPAN> <SPAN class="global-variable">true</SPAN><BR>
|
|
<SPAN
|
|
class="semantic-keyword">else</SPAN> <SPAN class="global-variable">member</SPAN>(<SPAN
|
|
class="local-variable">id</SPAN>, <SPAN class="global-variable">rest</SPAN>(<SPAN
|
|
class="local-variable">list</SPAN>))</P>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">IdentifierOrReservedWord</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <VAR class="nonterminal">IdentifierName</VAR></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">Token</SPAN>[<VAR
|
|
class="nonterminal">IdentifierOrReservedWord</VAR>] : <SPAN
|
|
class="type-name">Token</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Token</SPAN>[<VAR
|
|
class="nonterminal">IdentifierOrReservedWord</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">IdentifierName</VAR>]<BR>
|
|
= <SPAN class="semantic-keyword">let</SPAN> <SPAN
|
|
class="local-variable">id</SPAN>: <SPAN class="type-name">String</SPAN> = <SPAN
|
|
class="action-name">Name</SPAN>[<VAR class="nonterminal">IdentifierName</VAR>]<BR>
|
|
<SPAN class="semantic-keyword">in</SPAN> <SPAN
|
|
class="semantic-keyword">if</SPAN> <SPAN class="global-variable">member</SPAN>(<SPAN
|
|
class="local-variable">id</SPAN>, <SPAN class="global-variable">reservedWords</SPAN>)<BR>
|
|
<SPAN
|
|
class="semantic-keyword">then</SPAN> <SPAN class="field-name">reservedWord</SPAN> <SPAN
|
|
class="local-variable">id</SPAN><BR>
|
|
<SPAN
|
|
class="semantic-keyword">else</SPAN> <SPAN class="field-name">identifier</SPAN> <SPAN
|
|
class="local-variable">id</SPAN></P>
|
|
|
|
<H2>Punctuators</H2>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>></CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE><</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>=</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>=</CODE> <CODE>=</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE><</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>></CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>!</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>!</CODE> <CODE>=</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>,</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>!</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>~</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>?</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>:</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>.</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>&</CODE> <CODE>&</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>|</CODE> <CODE>|</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>+</CODE> <CODE>+</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>-</CODE> <CODE>-</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>+</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>-</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>*</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>/</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>&</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>|</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>^</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>%</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE><</CODE> <CODE><</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>></CODE> <CODE>></CODE></DIV>
|
|
<DIV
|
|
class="grammar-rhs">| <CODE>></CODE> <CODE>></CODE> <CODE>></CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>+</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>-</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>*</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>/</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>&</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>|</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>^</CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>%</CODE> <CODE>=</CODE></DIV>
|
|
<DIV
|
|
class="grammar-rhs">| <CODE><</CODE> <CODE><</CODE> <CODE>=</CODE></DIV>
|
|
<DIV
|
|
class="grammar-rhs">| <CODE>></CODE> <CODE>></CODE> <CODE>=</CODE></DIV>
|
|
<DIV
|
|
class="grammar-rhs">| <CODE>></CODE> <CODE>></CODE> <CODE>></CODE> <CODE>=</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>(</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>)</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>{</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>}</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>[</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>]</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>;</CODE></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">Punctuator</SPAN>[<VAR class="nonterminal">Punctuator</VAR>] : <SPAN
|
|
class="type-name">String</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>=</CODE>] = “<CODE>=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>></CODE>] = “<CODE>></CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE><</CODE>] = “<CODE><</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>=</CODE> <CODE>=</CODE>] = “<CODE>==</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>=</CODE> <CODE>=</CODE> <CODE>=</CODE>] = “<CODE>===</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE><</CODE> <CODE>=</CODE>] = “<CODE><=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>></CODE> <CODE>=</CODE>] = “<CODE>>=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>!</CODE> <CODE>=</CODE>] = “<CODE>!=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>!</CODE> <CODE>=</CODE> <CODE>=</CODE>] = “<CODE>!==</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>,</CODE>] = “<CODE>,</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>!</CODE>] = “<CODE>!</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>~</CODE>] = “<CODE>~</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>?</CODE>] = “<CODE>?</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>:</CODE>] = “<CODE>:</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>.</CODE>] = “<CODE>.</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>&</CODE> <CODE>&</CODE>] = “<CODE>&&</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>|</CODE> <CODE>|</CODE>] = “<CODE>||</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>+</CODE> <CODE>+</CODE>] = “<CODE>++</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>-</CODE> <CODE>-</CODE>] = “<CODE>--</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>+</CODE>] = “<CODE>+</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>-</CODE>] = “<CODE>-</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>*</CODE>] = “<CODE>*</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>/</CODE>] = “<CODE>/</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>&</CODE>] = “<CODE>&</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>|</CODE>] = “<CODE>|</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>^</CODE>] = “<CODE>^</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>%</CODE>] = “<CODE>%</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE><</CODE> <CODE><</CODE>] = “<CODE><<</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>></CODE> <CODE>></CODE>] = “<CODE>>></CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>></CODE> <CODE>></CODE> <CODE>></CODE>] = “<CODE>>>></CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>+</CODE> <CODE>=</CODE>] = “<CODE>+=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>-</CODE> <CODE>=</CODE>] = “<CODE>-=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>*</CODE> <CODE>=</CODE>] = “<CODE>*=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>/</CODE> <CODE>=</CODE>] = “<CODE>/=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>&</CODE> <CODE>=</CODE>] = “<CODE>&=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>|</CODE> <CODE>=</CODE>] = “<CODE>|=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>^</CODE> <CODE>=</CODE>] = “<CODE>^=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>%</CODE> <CODE>=</CODE>] = “<CODE>%=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE><</CODE> <CODE><</CODE> <CODE>=</CODE>] = “<CODE><<=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>></CODE> <CODE>></CODE> <CODE>=</CODE>] = “<CODE>>>=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>></CODE> <CODE>></CODE> <CODE>></CODE> <CODE>=</CODE>] = “<CODE>>>>=</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>(</CODE>] = “<CODE>(</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>)</CODE>] = “<CODE>)</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>{</CODE>] = “<CODE>{</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>}</CODE>] = “<CODE>}</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>[</CODE>] = “<CODE>[</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>]</CODE>] = “<CODE>]</CODE>”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">Punctuator</SPAN>[<VAR
|
|
class="nonterminal">Punctuator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>;</CODE>] = “<CODE>;</CODE>”</P>
|
|
|
|
<H2>Numeric literals</H2>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">NumericLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">DecimalLiteral</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">HexIntegerLiteral</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">OctalIntegerLiteral</VAR></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">DoubleValue</SPAN>[<VAR
|
|
class="nonterminal">NumericLiteral</VAR>] : <SPAN class="type-name">Double</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">DoubleValue</SPAN>[<VAR
|
|
class="nonterminal">NumericLiteral</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">DecimalLiteral</VAR>]<BR>
|
|
= <SPAN class="global-variable">rationalToDouble</SPAN>(<SPAN
|
|
class="action-name">RationalValue</SPAN>[<VAR class="nonterminal">DecimalLiteral</VAR>])</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">DoubleValue</SPAN>[<VAR
|
|
class="nonterminal">NumericLiteral</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">HexIntegerLiteral</VAR>]<BR>
|
|
= <SPAN class="global-variable">rationalToDouble</SPAN>(<SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR class="nonterminal">HexIntegerLiteral</VAR>])</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">DoubleValue</SPAN>[<VAR
|
|
class="nonterminal">NumericLiteral</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">OctalIntegerLiteral</VAR>]<BR>
|
|
= <SPAN class="global-variable">rationalToDouble</SPAN>(<SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR class="nonterminal">OctalIntegerLiteral</VAR>])</P>
|
|
|
|
<P class="semantics"><SPAN class="global-variable">expt</SPAN>(<SPAN
|
|
class="local-variable">base</SPAN>: <SPAN class="type-name">Rational</SPAN>, <SPAN
|
|
class="local-variable">exponent</SPAN>: <SPAN
|
|
class="type-name">Integer</SPAN>) : <SPAN class="type-name">Rational</SPAN><BR>
|
|
= <SPAN class="semantic-keyword">if</SPAN> <SPAN
|
|
class="local-variable">exponent</SPAN> = 0<BR>
|
|
<SPAN class="semantic-keyword">then</SPAN> 1<BR>
|
|
<SPAN class="semantic-keyword">else</SPAN> <SPAN
|
|
class="semantic-keyword">if</SPAN> <SPAN
|
|
class="local-variable">exponent</SPAN> < 0<BR>
|
|
<SPAN class="semantic-keyword">then</SPAN> 1/<SPAN
|
|
class="global-variable">expt</SPAN>(<SPAN class="local-variable">base</SPAN>, -<SPAN
|
|
class="local-variable">exponent</SPAN>)<BR>
|
|
<SPAN class="semantic-keyword">else</SPAN> <SPAN
|
|
class="local-variable">base</SPAN>*<SPAN class="global-variable">expt</SPAN>(<SPAN
|
|
class="local-variable">base</SPAN>, <SPAN
|
|
class="local-variable">exponent</SPAN> - 1)</P>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">DecimalLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <VAR class="nonterminal">Mantissa</VAR> <VAR
|
|
class="nonterminal">Exponent</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">Mantissa</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR
|
|
class="nonterminal">DecimalIntegerLiteral</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR
|
|
class="nonterminal">DecimalIntegerLiteral</VAR> <CODE>.</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <VAR
|
|
class="nonterminal">DecimalIntegerLiteral</VAR> <CODE>.</CODE> <VAR
|
|
class="nonterminal">Fraction</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>.</CODE> <VAR
|
|
class="nonterminal">Fraction</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">DecimalIntegerLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <CODE>0</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">NonZeroDecimalDigits</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">NonZeroDecimalDigits</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">NonZeroDigit</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR
|
|
class="nonterminal">NonZeroDecimalDigits</VAR> <VAR
|
|
class="nonterminal">DecimalDigit</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">NonZeroDigit</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>1</CODE> | <CODE>2</CODE> | <CODE>3</CODE> | <CODE>4</CODE> | <CODE>5</CODE> | <CODE>6</CODE> | <CODE>7</CODE> | <CODE>8</CODE> | <CODE>9</CODE></DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">Fraction</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <VAR class="nonterminal">DecimalDigits</VAR></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">RationalValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalLiteral</VAR>] : <SPAN class="type-name">Rational</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">RationalValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalLiteral</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">Mantissa</VAR> <VAR class="nonterminal">Exponent</VAR>]<BR>
|
|
= <SPAN class="action-name">RationalValue</SPAN>[<VAR
|
|
class="nonterminal">Mantissa</VAR>]*<SPAN class="global-variable">expt</SPAN>(10, <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR class="nonterminal">Exponent</VAR>])</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">RationalValue</SPAN>[<VAR class="nonterminal">Mantissa</VAR>] : <SPAN
|
|
class="type-name">Rational</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">RationalValue</SPAN>[<VAR
|
|
class="nonterminal">Mantissa</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">DecimalIntegerLiteral</VAR>] = <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR class="nonterminal">DecimalIntegerLiteral</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">RationalValue</SPAN>[<VAR
|
|
class="nonterminal">Mantissa</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">DecimalIntegerLiteral</VAR> <CODE>.</CODE>] = <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR class="nonterminal">DecimalIntegerLiteral</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">RationalValue</SPAN>[<VAR
|
|
class="nonterminal">Mantissa</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">DecimalIntegerLiteral</VAR> <CODE>.</CODE> <VAR
|
|
class="nonterminal">Fraction</VAR>]<BR>
|
|
= <SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalIntegerLiteral</VAR>] + <SPAN
|
|
class="action-name">RationalValue</SPAN>[<VAR class="nonterminal">Fraction</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">RationalValue</SPAN>[<VAR
|
|
class="nonterminal">Mantissa</VAR> <SPAN class="symbol">Þ</SPAN> <CODE>.</CODE> <VAR
|
|
class="nonterminal">Fraction</VAR>] = <SPAN class="action-name">RationalValue</SPAN>[<VAR
|
|
class="nonterminal">Fraction</VAR>]</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalIntegerLiteral</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalIntegerLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>0</CODE>] = 0</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalIntegerLiteral</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">NonZeroDecimalDigits</VAR>]<BR>
|
|
= <SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">NonZeroDecimalDigits</VAR>]</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">NonZeroDecimalDigits</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">NonZeroDecimalDigits</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">NonZeroDigit</VAR>] = <SPAN
|
|
class="action-name">DecimalValue</SPAN>[<VAR class="nonterminal">NonZeroDigit</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">NonZeroDecimalDigits</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">NonZeroDecimalDigits<SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">DecimalDigit</VAR>]<BR>
|
|
= 10*<SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">NonZeroDecimalDigits<SUB>1</SUB></VAR>] + <SPAN
|
|
class="action-name">DecimalValue</SPAN>[<VAR class="nonterminal">DecimalDigit</VAR>]</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">DigitValue</SPAN>[<VAR class="nonterminal">NonZeroDigit</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN> = <SPAN class="global-variable">digitValue</SPAN>(<VAR
|
|
class="nonterminal">NonZeroDigit</VAR>)</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">RationalValue</SPAN>[<VAR class="nonterminal">Fraction</VAR>] : <SPAN
|
|
class="type-name">Rational</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">RationalValue</SPAN>[<VAR
|
|
class="nonterminal">Fraction</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">DecimalDigits</VAR>]<BR>
|
|
= <SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalDigits</VAR>]/<SPAN class="global-variable">expt</SPAN>(10, <SPAN
|
|
class="action-name">NDigits</SPAN>[<VAR class="nonterminal">DecimalDigits</VAR>])</P>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">Exponent</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> «empty»</DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">ExponentIndicator</VAR> <VAR
|
|
class="nonterminal">SignedInteger</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">ExponentIndicator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>E</CODE> | <CODE>e</CODE></DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">SignedInteger</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">DecimalDigits</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>+</CODE> <VAR
|
|
class="nonterminal">DecimalDigits</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>-</CODE> <VAR
|
|
class="nonterminal">DecimalDigits</VAR></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR class="nonterminal">Exponent</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">Exponent</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> «empty»] = 0</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">Exponent</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">ExponentIndicator</VAR> <VAR
|
|
class="nonterminal">SignedInteger</VAR>] = <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR class="nonterminal">SignedInteger</VAR>]</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">SignedInteger</VAR>] : <SPAN class="type-name">Integer</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">SignedInteger</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">DecimalDigits</VAR>] = <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR class="nonterminal">DecimalDigits</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">SignedInteger</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>+</CODE> <VAR
|
|
class="nonterminal">DecimalDigits</VAR>] = <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR class="nonterminal">DecimalDigits</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">SignedInteger</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>-</CODE> <VAR
|
|
class="nonterminal">DecimalDigits</VAR>] = -<SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR class="nonterminal">DecimalDigits</VAR>]</P>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">DecimalDigits</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">DecimalDigit</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">DecimalDigits</VAR> <VAR
|
|
class="nonterminal">DecimalDigit</VAR></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalDigits</VAR>] : <SPAN class="type-name">Integer</SPAN></P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">NDigits</SPAN>[<VAR class="nonterminal">DecimalDigits</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalDigits</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">DecimalDigit</VAR>] = <SPAN
|
|
class="action-name">DecimalValue</SPAN>[<VAR class="nonterminal">DecimalDigit</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">NDigits</SPAN>[<VAR
|
|
class="nonterminal">DecimalDigits</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">DecimalDigit</VAR>] = 1</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalDigits</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">DecimalDigits<SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">DecimalDigit</VAR>]<BR>
|
|
= 10*<SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">DecimalDigits<SUB>1</SUB></VAR>] + <SPAN
|
|
class="action-name">DecimalValue</SPAN>[<VAR class="nonterminal">DecimalDigit</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">NDigits</SPAN>[<VAR
|
|
class="nonterminal">DecimalDigits</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">DecimalDigits<SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">DecimalDigit</VAR>] = <SPAN class="action-name">NDigits</SPAN>[<VAR
|
|
class="nonterminal">DecimalDigits<SUB>1</SUB></VAR>] + 1</P>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">HexIntegerLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <CODE>0</CODE> <VAR
|
|
class="nonterminal">HexIndicator</VAR> <VAR class="nonterminal">HexDigit</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">HexIntegerLiteral</VAR> <VAR
|
|
class="nonterminal">HexDigit</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">HexIndicator</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>X</CODE> | <CODE>x</CODE></DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">HexDigit</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>0</CODE> | <CODE>1</CODE> | <CODE>2</CODE> | <CODE>3</CODE> | <CODE>4</CODE> | <CODE>5</CODE> | <CODE>6</CODE> | <CODE>7</CODE> | <CODE>8</CODE> | <CODE>9</CODE> | <CODE>A</CODE> | <CODE>B</CODE> | <CODE>C</CODE> | <CODE>D</CODE> | <CODE>E</CODE> | <CODE>F</CODE> | <CODE>a</CODE> | <CODE>b</CODE> | <CODE>c</CODE> | <CODE>d</CODE> | <CODE>e</CODE> | <CODE>f</CODE></DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">OctalIntegerLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <CODE>0</CODE> <VAR
|
|
class="nonterminal">OctalDigit</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">OctalIntegerLiteral</VAR> <VAR
|
|
class="nonterminal">OctalDigit</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">OctalDigit</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>0</CODE> | <CODE>1</CODE> | <CODE>2</CODE> | <CODE>3</CODE> | <CODE>4</CODE> | <CODE>5</CODE> | <CODE>6</CODE> | <CODE>7</CODE></DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">HexIntegerLiteral</VAR>] : <SPAN class="type-name">Integer</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">HexIntegerLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>0</CODE> <VAR
|
|
class="nonterminal">HexIndicator</VAR> <VAR
|
|
class="nonterminal">HexDigit</VAR>] = <SPAN class="action-name">HexValue</SPAN>[<VAR
|
|
class="nonterminal">HexDigit</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">HexIntegerLiteral</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">HexIntegerLiteral<SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">HexDigit</VAR>]<BR>
|
|
= 16*<SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">HexIntegerLiteral<SUB>1</SUB></VAR>] + <SPAN
|
|
class="action-name">HexValue</SPAN>[<VAR class="nonterminal">HexDigit</VAR>]</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">DigitValue</SPAN>[<VAR class="nonterminal">HexDigit</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN> = <SPAN class="global-variable">digitValue</SPAN>(<VAR
|
|
class="nonterminal">HexDigit</VAR>)</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">OctalIntegerLiteral</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">OctalIntegerLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>0</CODE> <VAR
|
|
class="nonterminal">OctalDigit</VAR>] = <SPAN class="action-name">OctalValue</SPAN>[<VAR
|
|
class="nonterminal">OctalDigit</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">OctalIntegerLiteral</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">OctalIntegerLiteral<SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">OctalDigit</VAR>]<BR>
|
|
= 8*<SPAN class="action-name">IntegerValue</SPAN>[<VAR
|
|
class="nonterminal">OctalIntegerLiteral<SUB>1</SUB></VAR>] + <SPAN
|
|
class="action-name">OctalValue</SPAN>[<VAR class="nonterminal">OctalDigit</VAR>]</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">OctalDigit</VAR>] : <SPAN
|
|
class="type-name">Character</SPAN> = <VAR class="nonterminal">OctalDigit</VAR></P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">DigitValue</SPAN>[<VAR class="nonterminal">OctalDigit</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN> = <SPAN class="global-variable">digitValue</SPAN>(<VAR
|
|
class="nonterminal">OctalDigit</VAR>)</P>
|
|
|
|
<H2>String literals</H2>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-argument"><VAR class="nonterminal"><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></VAR> <SPAN class="symbol">Î</SPAN> {<VAR
|
|
class="nonterminal"><SPAN class="nonterminal-attribute">single</SPAN></VAR>, <VAR
|
|
class="nonterminal"><SPAN class="nonterminal-attribute">double</SPAN></VAR>}</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">StringLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <CODE>'</CODE> <VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-attribute">single</SPAN></SUP></VAR> <CODE>'</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>"</CODE> <VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-attribute">double</SPAN></SUP></VAR> <CODE>"</CODE></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">StringLiteral</VAR>] : <SPAN class="type-name">String</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">StringLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>'</CODE> <VAR class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-attribute">single</SPAN></SUP></VAR> <CODE>'</CODE>] = <SPAN
|
|
class="action-name">StringValue</SPAN>[<VAR class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-attribute">single</SPAN></SUP></VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">StringLiteral</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>"</CODE> <VAR class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-attribute">double</SPAN></SUP></VAR> <CODE>"</CODE>] = <SPAN
|
|
class="action-name">StringValue</SPAN>[<VAR class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-attribute">double</SPAN></SUP></VAR>]</P>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <SPAN class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <CODE>\</CODE> <VAR
|
|
class="nonterminal">ShortOctalEscape</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <SPAN class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> «empty»</DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <VAR
|
|
class="nonterminal">PlainStringChar</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <VAR
|
|
class="nonterminal">PlainStringQuote<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <VAR
|
|
class="nonterminal">OctalDigit</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <CODE>\</CODE> <VAR
|
|
class="nonterminal">OrdinaryEscape</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">PlainStringChar</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">AnyCharacter</VAR> <B>except</B> <CODE>'</CODE> | <CODE>"</CODE> | <CODE>\</CODE> | <VAR
|
|
class="nonterminal">OctalDigit</VAR> | <VAR class="nonterminal">LineTerminator</VAR></DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">PlainStringQuote<SUP><SPAN
|
|
class="nonterminal-attribute">single</SPAN></SUP></VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>"</CODE></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">PlainStringQuote<SUP><SPAN
|
|
class="nonterminal-attribute">double</SPAN></SUP></VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>'</CODE></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">StringValue</SPAN>[<VAR class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR>] : <SPAN
|
|
class="type-name">String</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR>]<BR>
|
|
= <SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP><SUB>1</SUB></VAR> <CODE>\</CODE> <VAR
|
|
class="nonterminal">ShortOctalEscape</VAR>]<BR>
|
|
= <SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP><SUB>1</SUB></VAR>] <SPAN
|
|
class="symbol">¨</SPAN> <B>[</B><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">ShortOctalEscape</VAR>]<B>]</B></P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">StringValue</SPAN>[<VAR class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR>] : <SPAN
|
|
class="type-name">String</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <SPAN
|
|
class="symbol">Þ</SPAN> «empty»] = “”</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <VAR
|
|
class="nonterminal">PlainStringChar</VAR>]<BR>
|
|
= <SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR>] <SPAN
|
|
class="symbol">¨</SPAN> <B>[</B><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">PlainStringChar</VAR>]<B>]</B></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <VAR
|
|
class="nonterminal">PlainStringQuote<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR>]<BR>
|
|
= <SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR>] <SPAN
|
|
class="symbol">¨</SPAN> <B>[</B><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">PlainStringQuote<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR>]<B>]</B></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP><SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">OctalDigit</VAR>]<BR>
|
|
= <SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP><SUB>1</SUB></VAR>] <SPAN
|
|
class="symbol">¨</SPAN> <B>[</B><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">OctalDigit</VAR>]<B>]</B></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryStringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR> <CODE>\</CODE> <VAR
|
|
class="nonterminal">OrdinaryEscape</VAR>]<BR>
|
|
= <SPAN class="action-name">StringValue</SPAN>[<VAR
|
|
class="nonterminal">StringChars<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR>] <SPAN
|
|
class="symbol">¨</SPAN> <B>[</B><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryEscape</VAR>]<B>]</B></P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">PlainStringChar</VAR>] : <SPAN
|
|
class="type-name">Character</SPAN> = <VAR class="nonterminal">PlainStringChar</VAR></P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR class="nonterminal">PlainStringQuote<SUP><SPAN
|
|
class="nonterminal-argument">Quote</SPAN></SUP></VAR>] : <SPAN
|
|
class="type-name">Character</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">PlainStringQuote<SUP><SPAN
|
|
class="nonterminal-attribute">single</SPAN></SUP></VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>"</CODE>] = ‘<CODE>"</CODE>’</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">PlainStringQuote<SUP><SPAN
|
|
class="nonterminal-attribute">double</SPAN></SUP></VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>'</CODE>] = ‘<CODE>'</CODE>’</P>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">OrdinaryEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">StringCharEscape</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">FullOctalEscape</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">HexEscape</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">UnicodeEscape</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">StringNonEscape</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">StringNonEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">NonTerminator</VAR> <B>except</B> <VAR
|
|
class="nonterminal">OctalDigit</VAR> | <CODE>x</CODE> | <CODE>u</CODE> | <CODE>'</CODE> | <CODE>"</CODE> | <CODE>\</CODE> | <CODE>b</CODE> | <CODE>f</CODE> | <CODE>n</CODE> | <CODE>r</CODE> | <CODE>t</CODE> | <CODE>v</CODE></DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryEscape</VAR>] : <SPAN class="type-name">Character</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryEscape</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">StringCharEscape</VAR>] = <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR class="nonterminal">StringCharEscape</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryEscape</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">FullOctalEscape</VAR>] = <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR class="nonterminal">FullOctalEscape</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryEscape</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">HexEscape</VAR>] = <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR class="nonterminal">HexEscape</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryEscape</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">UnicodeEscape</VAR>] = <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR class="nonterminal">UnicodeEscape</VAR>]</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">OrdinaryEscape</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">StringNonEscape</VAR>] = <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR class="nonterminal">StringNonEscape</VAR>]</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringNonEscape</VAR>] : <SPAN
|
|
class="type-name">Character</SPAN> = <VAR class="nonterminal">StringNonEscape</VAR></P>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">StringCharEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <CODE>'</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>"</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>\</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>b</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>f</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>n</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>r</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>t</CODE></DIV>
|
|
<DIV class="grammar-rhs">| <CODE>v</CODE></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringCharEscape</VAR>] : <SPAN class="type-name">Character</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringCharEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>'</CODE>] = ‘<CODE>'</CODE>’</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringCharEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>"</CODE>] = ‘<CODE>"</CODE>’</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringCharEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>\</CODE>] = ‘<CODE>\</CODE>’</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringCharEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>b</CODE>] = ‘<CODE><SPAN
|
|
class="control">«BS»</SPAN></CODE>’</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringCharEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>f</CODE>] = ‘<CODE><SPAN
|
|
class="control">«FF»</SPAN></CODE>’</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringCharEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>n</CODE>] = ‘<CODE><SPAN
|
|
class="control">«LF»</SPAN></CODE>’</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringCharEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>r</CODE>] = ‘<CODE><SPAN
|
|
class="control">«CR»</SPAN></CODE>’</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringCharEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>t</CODE>] = ‘<CODE><SPAN
|
|
class="control">«TAB»</SPAN></CODE>’</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">StringCharEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>v</CODE>] = ‘<CODE><SPAN
|
|
class="control">«VT»</SPAN></CODE>’</P>
|
|
|
|
<H4>Syntax</H4>
|
|
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">ShortOctalEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">OctalDigit</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">ZeroToThree</VAR> <VAR
|
|
class="nonterminal">OctalDigit</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">FullOctalEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN></DIV>
|
|
<DIV class="grammar-rhs"> <VAR class="nonterminal">FourToSeven</VAR> <VAR
|
|
class="nonterminal">OctalDigit</VAR></DIV>
|
|
<DIV class="grammar-rhs">| <VAR class="nonterminal">ZeroToThree</VAR> <VAR
|
|
class="nonterminal">OctalDigit</VAR> <VAR class="nonterminal">OctalDigit</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">ZeroToThree</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>0</CODE> | <CODE>1</CODE> | <CODE>2</CODE> | <CODE>3</CODE></DIV>
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">FourToSeven</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>4</CODE> | <CODE>5</CODE> | <CODE>6</CODE> | <CODE>7</CODE></DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">HexEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>x</CODE> <VAR class="nonterminal">HexDigit</VAR> <VAR
|
|
class="nonterminal">HexDigit</VAR></DIV>
|
|
</DIV>
|
|
<DIV class="grammar-rule">
|
|
<DIV class="grammar-lhs"><VAR class="nonterminal">UnicodeEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>u</CODE> <VAR class="nonterminal">HexDigit</VAR> <VAR
|
|
class="nonterminal">HexDigit</VAR> <VAR class="nonterminal">HexDigit</VAR> <VAR
|
|
class="nonterminal">HexDigit</VAR></DIV>
|
|
</DIV>
|
|
<H4>Semantics</H4>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">ShortOctalEscape</VAR>] : <SPAN class="type-name">Character</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">ShortOctalEscape</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">OctalDigit</VAR>] = <SPAN
|
|
class="global-variable">codeToCharacter</SPAN>(<SPAN class="action-name">OctalValue</SPAN>[<VAR
|
|
class="nonterminal">OctalDigit</VAR>])</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">ShortOctalEscape</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">ZeroToThree</VAR> <VAR class="nonterminal">OctalDigit</VAR>]<BR>
|
|
= <SPAN class="global-variable">codeToCharacter</SPAN>(8*<SPAN
|
|
class="action-name">OctalValue</SPAN>[<VAR class="nonterminal">ZeroToThree</VAR>] + <SPAN
|
|
class="action-name">OctalValue</SPAN>[<VAR class="nonterminal">OctalDigit</VAR>])</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">FullOctalEscape</VAR>] : <SPAN class="type-name">Character</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">FullOctalEscape</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">FourToSeven</VAR> <VAR class="nonterminal">OctalDigit</VAR>]<BR>
|
|
= <SPAN class="global-variable">codeToCharacter</SPAN>(8*<SPAN
|
|
class="action-name">OctalValue</SPAN>[<VAR class="nonterminal">FourToSeven</VAR>] + <SPAN
|
|
class="action-name">OctalValue</SPAN>[<VAR class="nonterminal">OctalDigit</VAR>])</P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">FullOctalEscape</VAR> <SPAN class="symbol">Þ</SPAN> <VAR
|
|
class="nonterminal">ZeroToThree</VAR> <VAR
|
|
class="nonterminal">OctalDigit<SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">OctalDigit<SUB>2</SUB></VAR>]<BR>
|
|
= <SPAN class="global-variable">codeToCharacter</SPAN>(<BR>
|
|
64*<SPAN
|
|
class="action-name">OctalValue</SPAN>[<VAR
|
|
class="nonterminal">ZeroToThree</VAR>] + 8*<SPAN
|
|
class="action-name">OctalValue</SPAN>[<VAR
|
|
class="nonterminal">OctalDigit<SUB>1</SUB></VAR>] + <SPAN
|
|
class="action-name">OctalValue</SPAN>[<VAR class="nonterminal">OctalDigit<SUB>2</SUB></VAR>])</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">DigitValue</SPAN>[<VAR class="nonterminal">ZeroToThree</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN> = <SPAN class="global-variable">digitValue</SPAN>(<VAR
|
|
class="nonterminal">ZeroToThree</VAR>)</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">DigitValue</SPAN>[<VAR class="nonterminal">FourToSeven</VAR>] : <SPAN
|
|
class="type-name">Integer</SPAN> = <SPAN class="global-variable">digitValue</SPAN>(<VAR
|
|
class="nonterminal">FourToSeven</VAR>)</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">HexEscape</VAR>] : <SPAN class="type-name">Character</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">HexEscape</VAR> <SPAN class="symbol">Þ</SPAN> <CODE>x</CODE> <VAR
|
|
class="nonterminal">HexDigit<SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">HexDigit<SUB>2</SUB></VAR>]<BR>
|
|
= <SPAN class="global-variable">codeToCharacter</SPAN>(16*<SPAN
|
|
class="action-name">HexValue</SPAN>[<VAR
|
|
class="nonterminal">HexDigit<SUB>1</SUB></VAR>] + <SPAN
|
|
class="action-name">HexValue</SPAN>[<VAR class="nonterminal">HexDigit<SUB>2</SUB></VAR>])</P>
|
|
|
|
<P class="semantics"><SPAN class="semantic-keyword">action</SPAN> <SPAN
|
|
class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">UnicodeEscape</VAR>] : <SPAN class="type-name">Character</SPAN></P>
|
|
|
|
<P class="semantics-next"><SPAN class="action-name">CharacterValue</SPAN>[<VAR
|
|
class="nonterminal">UnicodeEscape</VAR> <SPAN
|
|
class="symbol">Þ</SPAN> <CODE>u</CODE> <VAR
|
|
class="nonterminal">HexDigit<SUB>1</SUB></VAR> <VAR
|
|
class="nonterminal">HexDigit<SUB>2</SUB></VAR> <VAR
|
|
class="nonterminal">HexDigit<SUB>3</SUB></VAR> <VAR
|
|
class="nonterminal">HexDigit<SUB>4</SUB></VAR>]<BR>
|
|
= <SPAN class="global-variable">codeToCharacter</SPAN>(<BR>
|
|
4096*<SPAN
|
|
class="action-name">HexValue</SPAN>[<VAR
|
|
class="nonterminal">HexDigit<SUB>1</SUB></VAR>] + 256*<SPAN
|
|
class="action-name">HexValue</SPAN>[<VAR
|
|
class="nonterminal">HexDigit<SUB>2</SUB></VAR>] + 16*<SPAN
|
|
class="action-name">HexValue</SPAN>[<VAR class="nonterminal">HexDigit<SUB>3</SUB></VAR>] +<BR>
|
|
<SPAN class="action-name">HexValue</SPAN>[<VAR
|
|
class="nonterminal">HexDigit<SUB>4</SUB></VAR>])</P>
|
|
|
|
</BODY>
|
|
</HTML>
|