File psl-1983/3-1/tests/mini-read.red artifact e65e25c076 part of check-in 255e9d69e6


% MINI-READ.RED - A small reader

CompileTime <<GLOBAL '(DEBUG);
              FLUID '(TOK!* TOKTYPE!* CH!* !*RAISE);>>;

Procedure READ;        
% start RATOM, get first fresh token
  Read1(Ratom());

Procedure READ1(x);
   If x eq '!( then  READLIST(RATOM()) % Skip the (
    else if  x eq '!' then CONS('QUOTE, NCONS READ())
    else x;

Procedure ReadList(x);    
% read LIST, starting at token x
 Begin scalar y;
  If x eq '!) then Return NIL;
  y:=Read1(x);   % Finish read CAR of pair
  x:=Ratom();    % Check dot
  If x eq '!. then return CONS(y,car READLIST(RATOM()));
  Return CONS(y , READLIST(x))
End;

End;


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]