Sender: SenderNameTooLong%SUMEX-AIM.STANFORD:EDU:Xerox Date: 5 Jan 88 18:39:54 PST (Tuesday) Subject: Interlisp to Commonlisp conversion package From: darrelj%sm.unisys:COM To: info-1100%sumex-aim.stanford cc: darrelj%sm.unisys:COM Return-Path: <@SUMEX-AIM.Stanford.EDU:sdcrdcf!sm.unisys.com!darrelj@PRC.Unisys.COM> Redistributed: Info-1100-Redistribute^.X Received: from SUMEX-AIM.Stanford.EDU by Xerox.COM ; 05 JAN 88 18:38:18 PST Received: from burdvax.PRC.Unisys.COM (PRC-GW.PRC.UNISYS.COM) by SUMEX-AIM.Stanford.EDU with TCP; Tue, 5 Jan 88 17:44:10 PST Received: by burdvax.PRC.Unisys.COM (burdvax) [5.54/1.0] id AA15346; Tue, 5 Jan 88 20:44:28 EST Received: by rdcf.sm.unisys.com (sdcrdcf) (5.51/Domain/jpb/2.7) id AA28679; Tue, 5 Jan 88 16:35:37 PST Message-Id: <8801060035.AA28679@rdcf.sm.unisys.com> Received: from XAVIER by sdcrdcf with PUP; Tue, 5 Jan 88 16:35 PST Original-Date: 5 Jan 88 16:34 PST (Tuesday) Interlisp-D into Xerox Commonlisp, we developed a collection of tools to automate the conversion as much as possible. These have been placed in {parcvax.xerox.com}/lisp/exchange. While we at Unisys have reasonable confidence in these tools, they are being made available with no promises of accuracy, completeness or support (though we would appreciate feedback). The tools run in Xerox Lyric Common Lisp. The following files are parts of it: TRANSOR -- A slightly modified version of Transor, to fix a few Lyric-related problems and provide the ability to emit a DEFINE-FILE-INFO expression and to use the value of TRANSOUTREADTABLE as the output readtable. We used TRANSOR because we were familiar with it, and it handles a lot of details needed to safely and surely traverse the code to be translated. The biggest impediment to adding to the transforms is that they are specified as teletype editor commands, and only old-time Interlispers have much experience with those. TSET -- The same version dating back to 1979. This is the part of transor used for interactively developing and testing translation rules. TRANSOR.LCOM -- contains the compilation of BOTH the above files. TO-COMMONLISP.XFORMS -- translation rules for 428 functions, 98 remarks and 4 auxiliary functions. It covers are large portion of Interlisp, including most Clisp constructs, and specifically handles any function with the same name in both Interlisp and Commonlisp, so that holes in a translation should result in calls to undefined functions. In many cases, nice transformations are used for easy cases, and ugly ones only for hard cases. This file sets TRANSOUTREADTABLE to be a copy of the XCL readtable which is case SENSITIVE, MYLOAD below reads it case INsensitive, so the resulting file will ultimately lose most case distinctions on reloading into Xerox Lisp (or other common lisps). This was a much debated point internally, but this seemed the best of three bad possibilities (e.g. print one of Cased AS ORIGinal which becomes CASED AS ORIGINAL on load, |Cased| AS |ORIGinal|, or CASED AS ORIGINAL INTERLISP-COMMONLISP.TEDIT -- A document describing the transformations and formacro. LOADTRAN -- contains a few functions which prevent many breaks on loading the translated file. The function MYLOAD is intended to load a translated file. LOADTRAN.DFASL -- compiled version FORMACRO and FORMACRO.DFASL -- Still another portable iteration macro for commonlisp. Its main claims are almost 100% compatibility with the semantics of the Interlisp-Clisp FOR (especially when used the the XFORMS which fix a few incompatibilities); and user extensibility (unfortunately not compatible with IL:I.S.OPR). Embedded keywords (e.g. IN, COLLECT) may be in any package. COMMON-MAKE and COMMON-MAKE.LCOM -- still another version of code to generate a more "common" source file. It handles more filepkg command types than most. Also, when used with COMMENTHACKS will successfully print ALL comments in semicolon format. Call IL:COMMON-MAKEFILE(file). It checks the MAKEFILE-ENVIRONMENT property to select a package and base. COMMENTHACKS and COMMENTHACKS.LCOM -- patches to the prettyprinter and to the DEFUN editor. The prettyprinter patches will print Interlisp (* --) comments as semicolon comments when *PRINT-SEMICOLON-COMMENTS* is 'IL:ALL. This file also redefines the ED method for DEFUNs so that the initials and date of editing get updated for DEFUNs just as Interlisp has always done for FNS. Because of the way things developed, these tools are not as fully integrated as they could have been. If we were doing it over, the TRANSOR step could have more carefully coordinated the new COMS so that COMMON-MAKE would be able to do the right thing. As it stands, the COMS generally have to be edited to change FNS to FUNCTIONS, etc, but you tend to need a few iterations of editing things before the compiler is completely happy anyway. The steps needed to do translations are roughly as follows: (LOAD 'TRANSOR.LCOM) (LOAD 'TO-COMMONLISP.XFORMS) (SETQ FIXSPELLDEFAULT 'N) ;; Otherwise DWIM gets too clever (SETQ XlatedRecords NIL) ;; This is currently set to records specific to the system we translated. TRANSOR files containing record declarations. The records MUST be translated before any code containing create/fetch/replace since the translation depends on the type of records. Also, the record declarations should be LOADED. In a large translation effort, save a file containing all needed declarations and the value of XlatedRecords computed by translating them. (TRANSOR 'file1) ... ;; results in file1.TRAN and file1.LSTRAN, see TRANSOR documentation. To load translated files into a fresh xerox lisp system: >From an XCL exec: (IL:SETPROPLIST '*COMMENT* (IL:GETPROPLIST 'IL:*)) (IL:PUTASSOC '*COMMENT* 'IL:* IL:PRETTYEQUIVLST) (LOAD 'LOADTRAN) (SETQ IL:*DEFUALT-MAKEFILE-ENVIRONMENT* '(:READTABLE "XCL" :PACKAGE ???)) (SETQ IL:CMLRDTBL (IL:FIND-READTABLE "XCL")) (LOAD 'FORMACRO.DFASL) if used interlisp for's ;; may need to import USER:FOR depending on packages you've set up. (MYLOAD 'translated-records) (MYLOAD 'file1.tran) ... A little work with ED and FILES? and you should be able to save a commonlisp version of your files (well, OK, a lot of work). Suggestions and questions to one of: darrelj@RDCF.SM.UNISYS.COM or darrel@CAM.UNISYS.COM, or fritzson@bigburd.prc.UNISYS.COM ----- End Forwarded Messages -----