Compaq AA-PWCBD-TE Computer Accessories User Manual


 
Lexical Elements of the DEC Text Processing Utility Language
4.10 Lexical Keywords
4.10.2 Specifying the Radix of Numeric Constants
You can specify constants with binary, octal, hexadecimal, and decimal radices.
To specify a numeric constant in binary, precede the number with %B. The
number can consist only of the digits 0 and 1.
To specify a numeric constant in octal, precede the number with %O. The number
can consist only of the digits 0 through 7.
To specify a numeric constant in hexadecimal, precede the number with %X. The
number can consist of digits 0–9 and A–F.
There is no radix specifier for decimal. Any numeric constant without an explicit
radix specifier is assumed to be decimal. The radix specifier may be in uppercase
or lowercase.
The following are examples of correct numeric constants:
!
! Many different ways of saying the same thing.
!
CONSTANT binary_constant := %b11111;
CONSTANT octal_constant := %o37;
CONSTANT decimal_constant := 31;
CONSTANT hex_constant := %x1f;
!
! Compile time expressions work, too.
!
CONSTANT negative_value := -%x1f;
CONSTANT strange_zero := hex_constant - %x1f;
Invalid constructs for numeric constants return the error level message TPU$_
UNKLEXICAL, "Unknown lexical element" during compilation. The following
examples are not valid:
constant bad_binary := %b123; ! only 0’s and 1’s are legal.
constant bad_hex := %x10abg; ! ’g’ is illegal digit.
constant not_a_radix := %z0123; ! No such radix.
4–34 Lexical Elements of the DEC Text Processing Utility Language