Re: Optimizing nested if statements?

Martin.Ward@durham.ac.uk
26 Jan 2003 16:29:42 -0500

          From comp.compilers

Related articles
Optimizing nested if statements? sperugin@csgrad.cs.vt.edu (Saverio Perugini) (2003-01-17)
Re: Optimizing nested if statements? christian.bau@cbau.freeserve.co.uk (Christian Bau) (2003-01-21)
Re: Optimizing nested if statements? terryg@qwest.net (Terry Greyzck) (2003-01-21)
Re: Optimizing nested if statements? vbdis@aol.com (2003-01-21)
Re: Optimizing nested if statements? sperugin@csgrad.cs.vt.edu (Saverio Perugini) (2003-01-25)
Re: Optimizing nested if statements? Martin.Ward@durham.ac.uk (2003-01-26)
Re: Optimizing nested if statements? sperugin@csgrad.cs.vt.edu (Saverio Perugini) (2003-02-06)
| List of all articles for this month |
From: Martin.Ward@durham.ac.uk
Newsgroups: comp.compilers
Date: 26 Jan 2003 16:29:42 -0500
Organization: Compilers Central
Keywords: optimize
Posted-Date: 26 Jan 2003 16:29:42 EST

> Therefore, I am looking for a syntax-to-syntax transformation. In
> other words, I want an actual semantically equivalent, yet
> syntactically different program.


This is precisely what the FermaT transformation system provides.


If z-1.wsl is the WSL program:


IF @a?
    THEN IF @b?
                  THEN IF @c?
                                THEN @S1
                            ELSIF @d?
                                THEN @S2 FI FI
ELSIF @e?
    THEN @S3 FI


Then run this program:


% dotrans z-1.wsl Align_Nested_Statements posn=1,1,2,1,1


This transforms z-1.wsl to z-2.wsl:


IF @a?
    THEN IF @b? AND @c?
                  THEN @S1
              ELSIF @b? AND @d?
                  THEN @S2
              ELSIF @b?
                  THEN SKIP FI
ELSIF @e?
    THEN @S3 FI


FermaT is available under the GPL from:


http://www.cse.dmu.ac.uk/~mward/fermat.html


and


http://www.durham.ac.uk/martin.ward/fermat.html


FermaT has been used commercially in assembler to C migration projects.
See the papers on my web site for details.


Martin


Martin.Ward@durham.ac.uk http://www.cse.dmu.ac.uk/~mward/ Erdos number: 4
G.K.Chesterton web site: http://www.cse.dmu.ac.uk/~mward/gkc/


Post a followup to this message

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