From mboxrd@z Thu Jan 1 00:00:00 1970 From: bakul@bitblocks.com (Bakul Shah) Date: Fri, 23 Mar 2018 11:27:08 -0700 Subject: [TUHS] long lived programs (was Re: RIP John Backus In-Reply-To: <201803230253.w2N2rr6O005722@tahoe.cs.Dartmouth.EDU> References: <201803230253.w2N2rr6O005722@tahoe.cs.Dartmouth.EDU> Message-ID: <5DAB3926-947C-4DC1-8C9D-04ADB40FB007@bitblocks.com> On Mar 22, 2018, at 7:53 PM, Doug McIlroy wrote: > > "The only thing I can think of is to use have programs that > translate programs in todays languages to a common but very > simple universal language for their "long term storage". May > be something like Lamport's TLA+? A very tough job. > " > > Maybe not so hard. An existence proof is Brenda Baker's "struct", > which was in v7. It converted Fortran to Ratfor (which of course > turned it back to Fortran). Interestingly, authors found their > completely reorganized code easier to read than what they had > written in the first place. > > Her big discovery was a canonical form--it was not a matter of > taste or choice how the code got rearranged. > > It would be harder to convert the code to say, Matlab, > because then you'd have to unravel COMMON statements and > format strings. It's easy to cook up nasty examples, like > getting away with writing behyond the end of an array, but > such things are rare in working code. I can believe that for Fortran but for C/C++ or other such less well defined languages this may be much harder. Far easier to write an emulator for x86 and that is fine if all you want to do is run the same old compiled program but if you want to make changes, de-compiling x86 code to something structured would be much harder. Compiling the original code to a multi-paradigm language such as Scheme or Lisp may be another alternative.... [Aside: Thanks for mentioning the name of this program as I had forgotten it. I used "struct" once to convert a Fortran program to Ratfor and then manually to C. This was for programming PALs and we wanted to make some local changes. IIRC, this was back in '82, back when vendors gave you programs with sources for their devices, unlike the Xilinx & Altera of today who don't even publish bitstream formats used to program their devices.]