Xref: utzoo comp.compilers:1288 comp.lang.prolog:3179 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!world!esegue!compilers-sender From: kym@bingvaxu.cc.binghamton.edu.cc.binghamton.edu (R. Kym Horsell) Newsgroups: comp.compilers,comp.lang.prolog Subject: Re: Help on disassembler/decompilers Keywords: debug, prolog Message-ID: <4017@bingvaxu.cc.binghamton.edu> Date: 14 Sep 90 14:01:59 GMT References: <2900@network.ucsd.edu> <1990Sep9.010032.23235@sco.COM> <433@necssd.NEC.COM> <679@culhua.prg.ox.ac.uk> Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: kym@bingvaxu.cc.binghamton.edu.cc.binghamton.edu (R. Kym Horsell) Organization: SUNY Binghamton, NY Lines: 26 Approved: compilers@esegue.segue.boston.ma.us In article <679@culhua.prg.ox.ac.uk> Jonathan Bowen writes: >produce a high-level program or programs as output. The main problem is >running the necessary arithmetic backwards (i.e. avoiding the use of >"is") and I am currently looking into this. Has anyone else done any >similar work or can anyone supply any useful references? Funny, I didn't _see_ this in comp.lang.prolog... To answer your query, arithmetic _can_ be run backward. One simple, but inefficient, technique is to use ``unary'' arithmetic. (I.e. zero is 0, 1 is suc(0), 2 is suc(suc(0))). Rewriting the is/2, >/2, etc is a pain but it _can_ be done. Quite a lot of interesting work has been done on investigating which Prolog relations can run backward -- look thru the Int Conf on Logic Prog & similar things (they only go a few years so why check out the ref for you)? DHD Warren wrote a nice article in Software Practice and Experience regarding compiler-writing in Prolog -- check that out too (he writes fairly _neat_ code for one thing, and we're talking about readability here). -Kym Horsell -- Send compilers articles to compilers@esegue.segue.boston.ma.us {ima | spdcc | world}!esegue. Meta-mail to compilers-request@esegue.