Re: Lisp S-expression optimization ()
17 Feb 2001 01:33:10 -0500

          From comp.compilers

Related articles
Lisp S-expression optimization (Opium) (2001-02-15)
Re: Lisp S-expression optimization (2001-02-17)
| List of all articles for this month |

From: ()
Newsgroups: comp.compilers
Date: 17 Feb 2001 01:33:10 -0500
Organization: Eindhoven University of Technology, The Netherlands
References: 01-02-060
Keywords: Lisp, optimize
Posted-Date: 17 Feb 2001 01:33:10 EST

On 15 Feb 2001 00:32:01 -0500, Opium <> wrote:

>So the question becomes, how do I (for a given set of functions)
>process the s-expressions generated so that they are all in their
>simplest form?

Depending on the constructs you have in your parse tree, this problem
might not be computable. So finding the simplest form might not be possible,
and you might have to stick with just finding a simpler form.

A simple optimisation is to evaluate everything you can. I.e.
(+ 1 2) ==> 3. Also note rules of the form: (#f is false, #t is true)
  (and #f x) ==> #f
  (and #t x) ==> x
  (or #f x) ==> x
  (or #t x) ==> #t

  (and x x) ==> x
  (or x x) ==> x
  (if x y y) ==> y


Good luck,


ir. Stephan H.M.J. Houben
tel. +31-40-2474358 / +31-40-2743497

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.