Re: identifier renaming in nhc98



About this list Date view Thread view Subject view Author view

Olaf Chitil (olaf@cs.york.ac.uk)
Mon, 21 Aug 2000 17:38:39 +0100


Hi Bernie, > Perhaps more of a problem at the moment is the insertion of "| Prelude.True" > guards into the syntax tree after parsing. If this is done uniformly, I > assume I > can remove them, however it is a concern to me that there may be other > possible > modifications to the syntax tree during parsing. This is perhaps a naive > question, > but why are the guards inserted? And can I simply remove/ignore them? I believe that these guards are inserted to simplify the definition of the syntax tree: every equation has a guard. However, I find it annoying, too, and at some time in the future I want to change the definition of the syntax tree to use a Maybe type. Our tracer assumes that "| Prelude.True" was added by the compiler and does not insert any information about this guard into the Redex Trail. There is, however, the danger that the original program actually contained this guard. I fear that you will have some problems with modifications of the syntax tree, because you are interested in the result of the type checker. Our tracing transformation is earlier. Before the strongly connected component analysis, definitions for the selectors for records are created. Also for some reasons unkown to me the arity of method definitions is changed to match the number of ->'s occuring in the type. During type checking do-notation and record expressions are desugared. The type checker inserts the dictionaries for the class mechanism. So there are lots of changes to the syntax tree. > It seems like some type of association table is needed, > which links a unique name to the various forms from > the original program, essentially an un-rename function. Well, because an identifier may occur in several forms, I am not sure how such an un-rename function could be useful. > I have thought about trying to add this myself, however I am new to the > compiler > and adding this feature is not trivial. The main problem in my opinion is that the compiler contains hardly any abstract data types. So changing any data type definition will require changing lots of functions that pattern match on the data type. I'm fairly new to nhc as well, started working on it in June. Do you use the latest CVS version? Admittedly, it may not always work, but I am constantly adding lots of type definitions, type declarations and comments. Cheers, Olaf -- OLAF CHITIL, Dept. of Computer Science, University of York, York YO10 5DD, UK. URL: http://www.cs.york.ac.uk/~olaf/ Tel: +44 1904 434756; Fax: +44 1904 432767


About this list Date view Thread view Subject view Author view