RE: Help needed on SML compiler

cs450a03@uc780.umd.edu (Raul Rockwell)
27 MAR 91 08:35:38 GMT

          From comp.compilers

Related articles
RE: Help needed on SML compiler cs450a03@uc780.umd.edu (1991-00-27)
| List of all articles for this month |

Newsgroups: comp.compilers
From: cs450a03@uc780.umd.edu (Raul Rockwell)
Keywords: ML, functional
Organization: The University of Maryland University College
References: <9103260248.AA22854@enuxha.eas.asu.edu>
Date: 27 MAR 91 08:35:38 GMT

Surendar Chandra, working on a compiler for a functional language,
gives an example that basically runs:
    define function A
    use function A
    redefine function A
    use function A


Which, I think, points out the reason functional language advocates
tend to look at reassignment as a totally different operation than
assignment. Many would say that reassignment should be unimplemented
as much as possible.


However, the best way I can see to implement something like the above
is to simply say that the last definition of a name is the one which
is advertised outside the module. (e.g. given A@1, A@2 and A@3, where
@n indicates serial number, use A@3).


If the function associated with a name can change on-the-fly, for the
same body of code, you'll have to provide an interface for those
functions. This might be as simple as a "case statement" or, for ill
conditioned code, might be as complex as a call to some generalized
function resolver.


The case of "redefined on the fly" occurs with the use of global
references or where function definition occurs inside a loop (on
non-constant data) or where a function's definition depends on I/O
(e.g. construct fndef from file).


Raul Rockwell
--


Post a followup to this message

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