home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / gofer230.zip / Progs / Gofer / Demos / Modular / Readme < prev    next >
Text File  |  1994-06-23  |  3KB  |  74 lines

  1. ------------------------------------------------------------------------------
  2. The files in this directory are based on the programs described in:
  3.  
  4.     A Modular fully-lazy lambda lifter in Haskell
  5.     Simon L. Peyton Jones and David Lester
  6.     Software -- Practice and Experience
  7.     Vol 21(5), pp.479-506
  8.     MAY 1991
  9.  
  10. These files include:
  11.  
  12.     Readme       -- this file.
  13.  
  14.     Utility      -- implementation of various utility functions and
  15.                     data types including sets, bags and name supplies.
  16.                     The paper referred to above includes type signatures
  17.                     for the operations defined in this file but does not
  18.                     actually give definitions.  I trust that my own
  19.                     implementations of these functions will be satisfactory!
  20.  
  21.     LambdaLift   -- simple lambda lifter.  Contains code from the first
  22.                     half of the above paper.
  23.  
  24.     Laziness     -- transformations for fully-lazy lambda lifting.  Contains
  25.                     the remaining code from the above paper.
  26.  
  27.     Demo         -- demonstration of lamda lifting (normal and fully-lazy
  28.                     variants).  This hastily-written file contains definitions
  29.                     for a parser and input parser for the expressions used
  30.                     in the preceeding two files.  This file can only be loaded
  31.                     if the Parse file from MiniProlog has already been loaded
  32.                     into Gofer.  As it stands, this code uses non-standard
  33.                     features of Gofer and will not (i.e. should not!) be
  34.                     accepted by a Haskell compiler.
  35.  
  36. The modular fully-lazy lambda lifter and demonstration files can be loaded
  37. into Gofer with the command:
  38.  
  39.       gofer Utility LambdaLift Laziness ../Prolog/Parse Demo
  40.       (or, using the project file supplied, gofer + mlamlift.gp)
  41.  
  42. The kind of results that can be obtained are illustrated by:
  43.  
  44. ? show example1
  45. let f = (\x.let g = (\y.(Plus (Times x x) y)) in (Plus (g 3) (g 4))) in (f 6)
  46.  
  47. ? ll example1  
  48.    1) $main = let f = SC1 in (f 6)
  49.    2) SC1 x = let g = (SC0 x) in (Plus (g 3) (g 4))
  50.    3) SC0 x y = (Plus (Times x x) y)
  51.  
  52. ? fll example1
  53.    1) $main = let f0 = SC1 in (f0 6)
  54.    2) SC1 x1 = let v4 = (Plus (Times x1 x1)) in
  55.                let g2 = (SC0 v4) in (Plus (g2 3) (g2 4))
  56.    3) SC0 v4 y3 = (v4 y3)
  57.  
  58.  
  59. ? show example2
  60. let f = (\x.letrec g = (\y.(Cons (Times x x) (g y))) in (g 3)) in (f 6)
  61.  
  62. ? ll example2
  63.    1) $main = let f = SC1 in (f 6)
  64.    2) SC1 x = letrec g = (SC0 g x) in (g 3)
  65.    3) SC0 g x y = (Cons (Times x x) (g y))
  66.  
  67. ? fll example2
  68.    1) $main = let f0 = SC1 in (f0 6)
  69.    2) SC1 x1 = let v4 = (Cons (Times x1 x1)) in
  70.                letrec g2 = (SC0 g2 v4) in (g2 3)
  71.    3) SC0 g2 v4 y3 = (v4 (g2 y3))
  72.  
  73. ------------------------------------------------------------------------------
  74.