A Type- and Control-Flow Analysis for System F [chapter]

Matthew Fluet
2013 Lecture Notes in Computer Science  
We present a monovariant flow analysis for System F (with recursion). The flow analysis yields both control-flow information, approximating the λ-and Λ-expressions that may be bound to variables, and type-flow information, approximating the type expressions that may instantiate type variables. Moreover, the two flows are mutually beneficial: the control flow determines which Λ-expressions may be applied to which type expressions (and, hence, which type expressions may instantiate which type
more » ... ables), while the type flow filters the λ-and Λ-expressions that may be bound to variables (by keeping only those expressions with a static type that is compatible with the static type of the variable with respect to the type flow). As is typical for a monovariant control-flow analysis, control-flow information is expressed as an abstract environment mapping variables to sets of (syntactic) λ-and Λexpressions that appear in the program under analysis. Similarly, typeflow information is expressed as an abstract environment mapping type variables to sets of (syntactic) types that appear in the program under analysis. Compatibility of static types (with free type variables) with respect to a type flow is decided by interpreting the abstract environment as productions for a regular-tree grammar and asking if the languages generated by taking the types in question as starting terms have a nonempty intersection. This is a companion technical report, providing additional commentary and proof details, to a paper submitted to Implementation and Application of Functional Languages: 24th International Symposium (IFL'12).
doi:10.1007/978-3-642-41582-1_8 fatcat:djdtvghd2vbl7kd4n4bmwpnjpe