19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

escape sequences are useful for ASCII “shorthands” that begin with a lowercase letter or are not restricted words,<br />

and when the escape sequence is immediately followed in the string by a letter, digit, or underscore. For example,<br />

"\beta" evaluates to a string containing a backspace character (indicated by \b) followed by the letters e, t, and a,<br />

but "\’beta’" evaluates to a string containing the single letter β. 5 As another example, "x\AND\’NOT’y" becomes<br />

"x∧¬y", but "x\AND\NOTy" is a static error, because the name “NOTy” does not correspond to a Unicode character.<br />

Also, the string "Foo\’[\’T\’\]’" becomes "FooT".<br />

It is a static error if an unescaped backslash is immediately followed by a character other than another backslash, an<br />

apostrophe, a string literal delimiter, or a restricted-word character. In addition, it is also a static error if an unescaped<br />

backslash within a string literal is followed by any lowercase letter other than ‘b’, ‘t’, ‘n’, ‘f’ or ‘r’. This rule<br />

preserves a certain level of compatibility with the C and Java programming languages.<br />

Unlike elsewhere in a program, the enclosed characters of a string literal are not generally subject to the second<br />

phase of ASCII conversion (word pasting across line terminators still occurs within string literals). However, ASCII<br />

conversion may affect (and often replace) restricted-word and quoted-character escape sequences. Specifically, the<br />

restricted word of a restricted-word escape sequence and the sequence of characters between the apostrophes of a<br />

quoted-character escape sequence are subject to ASCII conversion. If that sequence of characters would be replaced<br />

by a single Unicode character, then the entire escape sequence is replaced by that character, unless the replacement<br />

character is a string literal delimiter, in which case the escape sequence is replaced by a backslash followed by the<br />

replacement character. For example, the string literal "GAMMA" is unchanged by ASCII conversion, but "\GAMMA" and<br />

"\’GAMMA’" are both changed to "Γ". <strong>The</strong> string literal "\\GAMMA" is also unchanged by ASCII conversion, because<br />

the sequence \\ is an escaped backslash; this string literal evaluates to a string value consisting of the six characters:<br />

\, G, A, M, M, and A. See Appendix E for a detailed discussion of the ASCII conversion process.<br />

<strong>The</strong> formatting of identifiers and numerals described in Section 5.17 is not performed within string literals.<br />

5.11 Boolean Literals<br />

<strong>The</strong> boolean literals are false and true .<br />

5.12 <strong>The</strong> Void Literal<br />

<strong>The</strong> void literal is () (pronounced “void”).<br />

5.13 Numerals<br />

Numeric literals in <strong>Fortress</strong> are referred to as numerals. Numerals may be either simple or compound.<br />

A numeral may consist of several words separated by spaces or a ‘ . ’ character. We adopt the following terminology:<br />

• A simple numeral fragment is a word that begins with a digit. and consists of only letters and digits.<br />

• A compound numeral fragment is a simple numeral fragment immediately followed by a ‘ . ’ character immediately<br />

followed by a word that consists of only letters and digits.<br />

• A sequence of characters is a numeral prefix if it is either a numeral fragment (simple or compound) or a numeral<br />

prefix immediately followed by a space immediately followed by a numeral fragment (simple or compound).<br />

5 Actually, the escape sequence \’beta’ is replaced by β during ASCII conversion.<br />

49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!