Re: identifier renaming in nhc98



About this list Date view Thread view Subject view Author view

Olaf Chitil (olaf@cs.york.ac.uk)
Thu, 17 Aug 2000 12:07:00 +0100


Hi Bernie, Bernard James POPE wrote: > So for this code: > > foo = let x1 = app addThree 1 2 3 in > let x2 = app inc 2 > in x1 + x2 > > The variable x1 gets renamed to "Main.Prelude.166.x1" > (by observing the symbol table after renaming). We also find it annoying that currently nhc is not able to give the name originally used in a program but always gives such a long and non-Haskell conformant name. > I looked at the renaming code and I noticed that > uniqueTid is called with the position of the identifier. My proposed > scheme is to incoporate the position of the variable > into the unique name generated so that from the original parse tree > I can find the occurrence of each variable in the symbol table > after renaming and typechecking has occurred. That is not the right place to make such a modification. uniqueTid just obtains the unique number of the identifier from a table, it does not change the tokenId at all. However, I don't understand why you want the position in the symboltable at all. The first problem is which position to put there. An identifier may occur several times in the program. Note also that the identifier may occur in various(!) forms: unqualified and qualified with serveral different module names (because of module renaming or because the identifier is imported via different modules). However, the syntax tree contains position information for everything, especially every occurrence of an identifier. I don't know exactly what you want to do, but can't you use that? I think it is a hack to use the position of an identifier to look up the original name in the source code, but with the positions in the syntax tree it should easily be doable. I also plan to make the intermediate outputs of nhc more readable and Haskell-conformant as far as possible. So I am thinking about how to preserve an original name in the tokenId. However, because an identifier may occur in different forms and I haven't yet fully understood, what the Qualified2 and Qualified3 kinds of TokenId are used for, I haven't yet done anything. By the way, are you continuing to develop Buddha? Here in York we started some month ago on developing the Redex Trail System further. We are always interested in exchanging ideas about tracing and debugging of lazy languages. 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