|Version 2 (modified by 10 years ago) (diff),|
[ Up: Commentary/Compiler/HscMain ]
module K where f x = True module N where import K module M where import N( f ) as Q f = (f, M.f, Q.f, \f -> f)
(where all the variables are
RdrNames). The result of renaming module M is:
M.f = (M.f, M.f, K.f, \f_22 -> f_22)
where all these names are now
- The top-level unqualifed
f" has become the
- The occurrences "
f" and "
M.f" are both bound to this
- The qualified
Q.f" becomes the
K.f, because the function is defined in module K.
- The lambda-bound "
f" becomes an
Internalname, here written
f_22. (All the
Externalnames have uniques too, but we often do not print them.)
In addition, the renamer does the following things:
- Sort out fixities. The parser parses all infix applications as right-associative, regardless of fixity. For example "
a * b + c" is parsed as "
a * (b + c)". The renamer re-associates such nested operator applications, using the fixities declared in the module.
- Dependency analysis for mutually-recursive groups of declarations. This divides the declarations into strongly-connected components.
- Lots of lexical error checking: variables out of scope, unused bindings, unused imports, patterns that use the same binder many times, etc.