
10.2     Printed Representation of LISP Objects
Most of this section is devoted to the representation of tokens. In addition to tokens there are
composite objects with printed representations: lists and vectors. We briefly discuss their printed
formats first.
"(" expression expression  . . . ")"
 
"(" expression expression . . . "." expression)
 
"[" expression expression . . . "]"
Of these the first two are for lists. Where possible, the first notation is preferred and the printing
routines use it except when the second form is needed. The second form is required when
the cdr of a pair is neither nil nor another pair. The third notation is for vectors. For
example:
(A . (B . C)) % An s-expression
 
(A B . C)     % Same value, list notation
 
(A B C)       % An ordinary list
 
[A B C]       % A vector
The following standards for representing tokens are used:
      
      - An id normally consists of uppercase letters and digits. The first character can be a
      digit when the first non-digit character is a plus sign, minus sign, or a letter other
      than ”E” or ”B”. We exclude lowercase letters because the PSL reader will normally
      convert lowercase letters to uppercase. Although the user may use lowercase letters,
      the interpreter only sees uppercase. This conversion is controlled by the value of
      the switch *raise, a value of nil will suppress this conversion. In addition to letters
      and numbers, the following characters are considered alphabetic for the purpose of
      notating symbols.
   
        + - $ & ⋆ / : ; | < = > ? ^ _ ~ @
  There is an escape convention for notating an id whose name contains special
      characters. In addition to lowercase letters the following characters are considered
      special.
    
        ! " % ' ( ) . [ ] ‘ , # |
    
 
 JULIE     % three ways to notate the same symbol
 julie
 JuLie
 +$
 1+
 +1        % this is a number, not an id
 x^2+y^2   % a single symbol
 
       
- Strings begin with a double quote (”) and include all characters up to a closing double
      quote. A double quote can be included in a string by doubling it. An empty string,
      consisting of only the enclosing quote marks, is allowed. The characters of a string are not
      affected by the value of the *raise. Examples:
   
        "This is a string"
    
 "This is a ""string"""
 ""
 
       
- Integers begin with a digit, optionally preceded by a + or - sign, and consist only of digits.
      The global input radix is 10; there is no way to change this. However, numbers of different
      radices may be read by the following convention. A decimal number from 2 to 36
      followed by a sharp sign (#), causes the digits (and possibly letters) that follow to be read
      in the radix of the number preceding the #. [Footnote: Octal numbers can also be written
      as a string of digits followed by the letter ”B”.] Thus 63 may be entered as 8#77, or 255 as
      16#ff or 16#FF. The output radix can be changed, by setting outputbase*. If outputbase*
      is not 10, the printed integer appears with appropriate radix. Leading zeros
      are suppressed and a minus sign precedes the digits if the integer is negative.
      Examples:
   
            100
    
 +5234
 -8#44 (equal to -36)
 
       
- Floats have a period and/or a letter ”e” or ”E” in them. Any of the following are read as
      floats. The value appears in the format [-]n.nn...nnE[-]mm if the magnitude of the
      number is too large or small to display in [-]nnnn.nnnn format. The crossover
      point is determined by the implementation. In BNF, floats are recognized by the
      grammar:
   
         <base>       ::= <unsigned-integer>.|
    
 .<unsigned-integer>|
 <unsigned-integer>.
 <unsigned-integer>
 <ebase>      ::= <base>|<unsigned-integer>
 <unsigned-float> ::= <base>|
 <ebase>e<unsigned-integer>|
 <ebase>e-<unsigned-integer>|
 <ebase>e+<unsigned-integer>|
 <ebase>E<unsigned-integer>|
 <ebase>E-<unsigned-integer>|
 <ebase>E+<unsigned-integer>
 <float>          ::= <unsigned-float>|
 +<unsigned-float>|
 -<unsigned-float>
  That is:
    
            [+|-][nnn][.]nnn{e|E}[+|-]nnn
    
 
 nnn.
 .nnn
 nnn.nnn
  Examples:
    
            1e6
    
 .2
 2.
 2.0
 -1.25E-9
 
       
- Code-pointers cannot be read directly, but can be printed and constructed. Currently
      printed as
   
       #<Code argument-count hexadecimal-address>.
 
       
- Anything else is printed as #<Unknown:nnnn>, where nnnn is the hexadecimal value
      found in the argument register. Such items are not legal LISP entities and may
      cause garbage collector errors if they are found in the heap. They cannot be read
      in.