Path: utzoo!attcan!uunet!world!esegue!compilers-sender From: hankd@dynamo.ecn.purdue.edu (Hank Dietz) Newsgroups: comp.compilers Subject: Re: Help on disassembler/decompilers Keywords: Fortran, design Message-ID: <9009142142.AA24016@dynamo.ecn.purdue.edu> Date: 14 Sep 90 21:42:52 GMT References: <6839.26ea3b0e@vax1.tcd.ie> <3972@bingvaxu.cc.binghamton.edu> Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: hankd@dynamo.ecn.purdue.edu (Hank Dietz) Organization: Purdue University Engineering Computer Network Lines: 33 Approved: compilers@esegue.segue.boston.ma.us In-Reply-To: <11326@alice.UUCP> In article <11326@alice.UUCP> you write: >vu0310@bingvaxu.cc.binghamton.edu.cc.binghamton.edu (R. Kym Horsell @ SUNY Binghamton, NY) says: >>I have made various attempts at writing assemlber -> HLL translators over >>the years, mostly inspired by the `beatify' tool that attempts to transform >>spagetti FORTRAN into structured FORTRAN. > >Wouldn't a `beatify' tool transform Profane Fortran into Blessed Fortran? >[We could always hope so. -John] Nope. The key transformation in fixing spaghetti code is an oldie but goodie called "code straightening." It's usually pretty easy. However, such transformations are generally not very good at dealing with comments. Not only are they notoriously bad at creating meaningful new comments automatically, but they don't even really know what to do with the comments that were in the original source. This last problem is rooted in the fact that most languages do not syntactically group comments with the source code constructs to which they apply (they are usually implemented as a lexical hack -- removed from the source before syntax analysis). Further, how does a beautifier know what the comment refers to -- it would be pretty strange, for example, to retain a comment about multiplying things when the multiply has been strength-reduced out of existence? One might argue that the big problem in programs today isn't unstructured use of GOTO, but unstructured use of comments.... One of my PhD students (Eng-Siong Tan) is currently investigating this problem.... -hankd@ecn.purdue.edu -- Send compilers articles to compilers@esegue.segue.boston.ma.us {ima | spdcc | world}!esegue. Meta-mail to compilers-request@esegue.