19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Note: the elegant way to write Avogadro’s number is 6.02 TIMES 10ˆ23, which is not a single token but is a<br />

constant expression; its rendered form is 6.02 × 10 23 .<br />

5.17.3 Identifiers<br />

<strong>Fortress</strong> has rather complicated rules for rendering an identifier; as in other parts of <strong>Fortress</strong>, the rules are complicated<br />

so that the simple cases will be very simple, but also so that difficult cases of interest will be possible.<br />

It is conventional in mathematical notation to make use of variables, particularly single-letter variables, in a number<br />

of different fonts or styles, with italic being the most common, then boldface, and roman: a , b , c . Frequently such<br />

variables are also decorated with accents and subscripts: ¯p , q ′ , ˆr , T max , ⃗u , v x , w 17 , ¯z ′ 17 . <strong>Fortress</strong> provides<br />

conventions for typing such variables using plain ASCII characters: for example, the unformatted presentations of<br />

these same variables are a , _b , c_ , p_bar , q’ or q_prime , r_hat , T_max , _u_vec , _v_x , w17 ,<br />

and z17_bar’ . <strong>The</strong> rules are also intended to accommodate the typical use of multicharacter variable names for<br />

computer programming, such as count , isUpperCase , and Boolean.<br />

<strong>The</strong> most important rules of thumb are that simple variables are usually italic z ( z ), a leading underscore usually<br />

means boldface font z ( _z ), a trailing underscore usually means roman font z ( z_ ), and a doubled capital letter<br />

means double-struck (or “blackboard bold”) font Z ( ZZ ). However, mixed-case variable names that begin with<br />

a capital letter, which are usually used as names of types, are rendered in roman font even if there is no trailing<br />

underscore.<br />

<strong>The</strong> detailed rules are described in Appendix D.<br />

5.17.4 Other Formatting Rules<br />

Special reserved words are rendered in monospace, except that the special reserved words that are used as operators<br />

on units, namely cubed, cubic, inverse, per, square, and squared, are rendered in roman type. Operator words<br />

are rendered in monospace. Comments are rendered in roman font. Any character within a character literal or string<br />

literal is rendered in monospace if possible. Delimiters of syntax expanders (described in Section 36.1) are rendered<br />

in monospace.<br />

53

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

Saved successfully!

Ooh no, something went wrong!