From: Tim Bradshaw <tfb@aiai.ed.ac.uk>
Newsgroups: comp.sys.hp48
Subject: Fixing RainEQ's symbolics
Date: 17 Aug 1998 10:58:38 +0100
Organization: AIAI, University of Edinburgh
Lines: 77
Sender: tfb@todday.aiai.ed.ac.uk
Message-ID: <ey3ogtkdj5d.fsf@todday.aiai.ed.ac.uk>
NNTP-Posting-Host: todday.aiai.ed.ac.uk
X-Newsreader: Gnus v5.2.25/XEmacs 19.14
Xref: republic.btigate.com comp.sys.hp48:14678

RainEQ produces symbolics which can sometimes make other programs
(alg48, perhaps Erable) unhappy, because they don't use the
`shorthands' for small binary integers.  RainEQ renders F(X) as:

SYMBOL
 ID X
 SYMBOL
  ID F
 ;
 # 1
 xFCNAPPLY
;

when it is expected to be:

SYMBOL
 ID X
 SYMBOL
  ID F
 ;
 ONE
 xFCNAPPLY
;

The attached SysRPL program will recusrively replace the bints from 1
to 10 in a symbolic by the appropriate shorthands.  RainEQ also gets
real numbers `wrong' too, but since they aren't structural parts of
the symbolics I don't think that will matter.

This is probably extremely naive RPL -- it's the first
non-playing-about SysRPL program I've written.  It can be compiled
with Jazz, I don't know about any of the other tools, sorry (don't
have a PC).  It needs to be called RFIX so it can find itself to
recurse.

--tim

---Cut for rfix.s---
* Try and fix RainEQ lossage
::
 CK&DISPATCH1
 symb
 ::
  INNERCOMP (explode it)
  {{ n }}
  n 0 DO
   n ROLL (spin it)
   ::
    DUPTYPEBINT?
    (fix bints naively)
    case
    ::
     (alist is easy)
     DUP
     ' #=
     {
      1 1 2 2 3 3 4 4 5 5 6 6
      7 7 8 8 9 9 10 10
     }
     Lookup
     case SWAPDROP
     DROP
    ;
    DUPTYPESYMB?
    (recurse -- D->LIB deals
     with linking)
    case
    ::
     ID RFIX
    ;
   ;
  LOOP
  n SYMBN (rebuild)
  ABND
 ;
 ZERO NOP
;