fortran-src-0.1.0.1: Parser and anlyses for Fortran standards 66, 77, 90.

Safe HaskellNone
LanguageHaskell2010

Language.Fortran.Analysis.Renaming

Description

Analyse variables/function names and produce unique names that can be used to replace the original names while maintaining program equivalence (a.k.a. alpha-conversion). The advantage of the unique names is that scoping issues can be ignored when doing further analysis.

Synopsis

Documentation

analyseRenames :: Data a => ProgramFile (Analysis a) -> ProgramFile (Analysis a) Source #

Annotate unique names for variable and function declarations and uses.

rename :: Data a => ProgramFile (Analysis a) -> (NameMap, ProgramFile (Analysis a)) Source #

Take the unique name annotations and substitute them into the actual AST.

extractNameMap :: Data a => ProgramFile (Analysis a) -> NameMap Source #

Create a map of unique name => original name for each variable and function in the program.

renameAndStrip :: Data a => ProgramFile (Analysis a) -> (NameMap, ProgramFile a) Source #

Perform the rename, stripAnalysis, and extractNameMap functions.

unrename :: Data a => (NameMap, ProgramFile a) -> ProgramFile a Source #

Take a renamed program and its corresponding NameMap, and undo the renames.

underRenaming :: (Data a, Data b) => (ProgramFile (Analysis a) -> b) -> ProgramFile a -> b Source #

Run a function with the program file placed under renaming analysis, then undo the renaming in the result of the function.