FUNCTION DISPFUN (F#U#N#, LEX1),
  NEWLINE(), NEWLINE(),
  UNPARSE(0, FALSE, LIST(GETD(F#U#N#))),
  PRINT(""),
ENDFUN $
F#U#N#: ""$
FUNCTION PRTARGS(IDENT, LEX1),
  SPACES(1),
  WHEN EMPTY(LEX1), PRINT("()") EXIT,
  WHEN ATOM(LEX1),  QUOTEPRINT(LEX1) EXIT,
  WHEN DPAIR(LEX1), PRINTDPAIR(LEX1) EXIT
  PRINT(LPAR),
  LOOP
      UNPARSE(IDENT, FALSE, LIST(FIRST(LEX1))),
      WHEN EMPTY(LEX1:REST(LEX1)) EXIT
      PRINT(COMMA), SPACES(1),
  ENDLOOP,
  PRINT(RPAR),
ENDFUN $
PROPERTY UNPARSE, ', FUNCTION(IDENT,LEX1),
  PRINT(''),
  PRTARGS(IDENT, FIRST(LEX1)),
  TRUE,
ENDFUN $
PROPERTY UNPARSE, NOT, FUNCTION(IDENT,LEX1),
  PRINT('NOT), SPACES(1),
  UNPARSE(IDENT, FALSE, LEX1),
  TRUE,
ENDFUN $
PROPERTY UNPARSE, FUNCTION, FUNCTION(IDENT,LEX1),
  PRINT('FUNCTION), SPACES(1), PRINT(F#U#N), F#U#N: "",
  PRTARGS(IDENT, FIRST(LEX1)),
  UNPARSE(IDENT+2, TRUE, REST(LEX1)),
  PRNTLINE(IDENT), PRINT('ENDFUN),
ENDFUN $
PROPERTY UNPARSE, SUBROUTINE, FUNCTION(IDENT,LEX1),
  PRINT('SUBROUTINE), SPACES(1), PRINT(F#U#N), F#U#N: "",
  PRTARGS(IDENT, FIRST(LEX1)),
  UNPARSE(IDENT+2, TRUE, REST(LEX1)),
  PRNTLINE(IDENT), PRINT('ENDSUB),
ENDFUN $
PROPERTY UNPARSE, LOOP, FUNCTION(IDENT,LEX1),
  PRINTLINE('LOOP), SPACES(IDENT+2),
  UNPARSE(IDENT+2, FALSE, LEX1),
  PRNTLINE(IDENT), PRINT('ENDLOOP),
ENDFUN $
FUNCTION UNPARSE(IDENT, EOL, LEX1, LEX2),
  WHEN EMPTY(LEX1) EXIT,
  LEX2:FIRST(LEX1),
  WHEN DPAIR(LEX2),  PRINTDPAIR(LEX2) EXIT,
  WHEN ATOM(LEX2),
    BLOCK
      WHEN EOL,  PRNTLINE(IDENT) EXIT,
    ENDBLOCK,
  QUOTEPRINT(LEX2) EXIT,
  BLOCK
    WHEN EOL, PRNTLINE(IDENT) EXIT,
  ENDBLOCK,
  WHEN ATOM(FIRST(LEX2)),
    UNPARSEFUN(IDENT,LEX2),
    UNPARSE(IDENT, TRUE, REST(LEX1)) EXIT,
  WHEN ATOM(FIRST(FIRST(LEX2))),
    UNPARSEWHEN(IDENT,LEX2),
    UNPARSE(IDENT, TRUE, REST(LEX1)) EXIT,
  UNPARSEBLOCK(IDENT, LEX2),
  UNPARSE(IDENT, TRUE, REST(LEX1)),
ENDFUN $
FUNCTION UNPARSEFUN(IDENT, LEX1, LEX2),
  LEX2:FIRST(LEX1),
  WHEN INTEGER(LEX2), PRINT(''),
      PRTARGS(IDENT,LEX1) EXIT,
  WHEN APPLY(GET(UNPARSE, LEX2), LIST(IDENT,REST(LEX1))) EXIT,
  WHEN GET('LBP, LEX2),
    WHEN EMPTY(RREST(LEX1)),
      PRINT(LEX2),
      SPACES(1),
      UNPARSE(IDENT, FALSE, REST(LEX1)) EXIT,
    UNPARSE(IDENT, FALSE, LIST(SECOND(LEX1))),
    SPACES(1), PRINT(LEX2), SPACES(1),
    UNPARSE(IDENT, FALSE, RREST(LEX1)) EXIT,
  PRINT(LEX2),
  PRTARGS(IDENT, REST(LEX1)),
ENDFUN $
FUNCTION UNPARSEWHEN (IDENT, LEX1),
  PRINT ('WHEN), SPACES(1),
  UNPARSE(IDENT+2, FALSE, LEX1),
  SPACES(1), PRINT('EXIT),
ENDFUN $
FUNCTION UNPARSEBLOCK (IDENT, LEX1),
  PRINTLINE('BLOCK), SPACES(IDENT+2),
  UNPARSE(IDENT+2, FALSE, LEX1),
  PRNTLINE(IDENT),
  PRINT('ENDBLOCK),
ENDFUN $
FUNCTION DPAIR(LEX1),
  WHEN ATOM(LEX1), FALSE EXIT,
  WHEN EMPTY(REST(LEX1)), FALSE EXIT,
  ATOM(FIRST(LEX1)) AND ATOM(REST(LEX1)),
ENDFUN $
FUNCTION PRINTDPAIR(LEX1),
  PRINT(LPAR), QUOTEPRINT(FIRST(LEX1)),
  PRINT(". "), QUOTEPRINT(REST(LEX1)),
  PRINT(RPAR),
ENDFUN $
FUNCTION PRNTLINE(IDENT),
  PRINTLINE(COMMA, SPACES(IDENT),
ENDFUN $
MOVD(PRINT, QUOTEPRINT) $
FUNCTION QUOTEPRINT(EX1,EX2,LEX1,LEX2),
  WHEN INTEGER(EX1), PRINT(EX1) EXIT,
  WHEN LENGTH(EX1)=0, PRINT("""""") EXIT,
  LEX1:EXPLODE(EX1),
  BLOCK
    WHEN DIGIT(FIRST(LEX2)),
      EX2:TRUE EXIT,
    LEX2:LEX1,
    LOOP
      WHEN WILDCHAR(FIRST(LEX2)),
        EX2:TRUE EXIT,
      LEX2:REST(LEX2),
      WHEN EMPTY(LEX2) EXIT,
    ENDLOOP,
  ENDBLOCK,
  WHEN NOT EX2, PRINT(EX1) EXIT,
  PRINT(""""),
  LOOP
    BLOCK
      WHEN PRINT(FIRST(LEX1))="""",
        PRINT("""") EXIT,
    ENDBLOCK,
    LEX1:REST(LEX1),
    WHEN EMPTY(LEX1) EXIT,
  ENDLOOP,
  PRINT(""""),
ENDFUN $
FUNCTION WILDCHAR(EX1),
  MEMBER(EX1, LIST('" ", '!, '"""", '$, '"%", '&, '', LPAR, RPAR, '*, '+,
COMMA, '-, '., '/, ':, ';, '<, '>, '=, '?, '^)),
ENDFUN $
FUNCTION DIGIT(EX1),
  MEMBER(EX1, '("0","1","2","3","4","5","6","7","8","9"))
ENDFUN $
SUBROUTINE WRITEFILE LEX1
  WRITEFILE1(FIRST(LEX1), REST(LEX1)),
ENDSUB $
FUNCTION WRITEFILE1(LEX1, LEX2),
  WRS(FIRST(LEX1), SECOND(LEX1), THIRD(LEX1)),
  LOOP
    WHEN EMPTY(LEX2) EXIT,
    PRINTFUN(FIRST(LEX2)),
    PRINTVAL(FIRST(LEX2)),
    PRINTPROPS(FIRST(LEX2)),
    LEX2:REST(LEX2),
  ENDLOOP,
  NEWLINE(), NEWLINE(),
  PRINT("RDS () $"),
  WRS(),
  FIRST(LEX1),
ENDFUN $
FUNCTION PRINTFUN(EX1),
  WHEN ATOM(GETD(EX1)) EXIT,
  DISPFUN(EX1),
  PRINT('$),
ENDFUN $
FUNCTION PRINTVAL(EX1),
  WHEN FIRST(EX1)=EX1 EXIT,
  NEWLINE(), NEWLINE(),
  QUOTEPRINT(EX1), PRINT(" : "),
  UNPARSE(2, FALSE, LIST(FIRST(EX1))),
  PRINTLINE('$),
ENDFUN $
FUNCTION PRINTPROPS(LEX1, LEX2),
  WHEN ATOM(LEX2:REST(LEX1)) EXIT,
  LOOP
    WHEN EMPTY(LEX2) EXIT,
    NEWLINE(), NEWLINE(),
    PRINT('PROPERTY),
    SPACES(1), QUOTEPRINT(LEX1),
    PRINT(", "), PRINT(FIRST(FIRST(LEX2))),
    UNPARSE(2, TRUE, LIST(REST(FIRST(LEX2)))),
    PRINTLINE('$),
    LEX2:REST(LEX2),
  ENDLOOP
ENDFUN $
STOP() $
RDS () $
TEPRINT(REST(LEX1)),
  PRINT(RPAR),
ENDFUN $
FUNCTION PRNTLINE(IDENT),
  