next up previous
Next: Integer Literals Up: Lexical Structure Previous: Identifiers

Literals

A literal is the source code representation of a value of a primitive type or the String type or the null type. All literals are represented internally by integers. The literal string represented by the integer i is the value of StringTable(i). Every instance of a particular literal is represented by the same integer.

Literal[12]:

Integer Literal[16]
Floating-Point Literal[20]
Character Literal[30]
String Literal[32]
This macro is invoked in definition 6.

The Boolean and null literals appear in the grammar as keywords and therefore have no separate lexical definition.

Numeric literals are converted to standard normalized forms and checked for validity before their integer representations are determined. This conversion is performed by Eli's string arithmetic module, which is also used to evaluate constant expressions:

Phrase.specs[13]:

$/Tech/strmath.specs
Instantiate necessary modules[54]
This macro is attached to a product file.

By default, Eli's string arithmetic module will represent a value whose exponent is -1 with a leading 0. This avoids the need for an explicit exponent, but does not conform to the definition of a normalized number. We therefore instruct the module not to perform such ``de-normalization'':

Phrase.head[14]:

#include "strmath.h"
This macro is attached to a product file.

Phrase.init[15]:

(void)strmath(STRM_DENORMALIZE, 0);
This macro is attached to a product file.



Subsections
next up previous
Next: Integer Literals Up: Lexical Structure Previous: Identifiers
2008-09-11