HOME

TheInfoList



OR:

In
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includin ...
, control-flow analysis (CFA) is a static-code-analysis technique for determining the
control flow In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an '' ...
of a program. The control flow is expressed as a
control-flow graph In computer science, a control-flow graph (CFG) is a representation, using graph notation, of all paths that might be traversed through a program during its execution. The control-flow graph was discovered by Frances E. Allen, who noted tha ...
(CFG). For both
functional programming language In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that ...
s and
object-oriented programming language Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
s, the term CFA, and elaborations such as ''k''-CFA, refer to specific algorithms that compute control flow. For many imperative programming languages, the control flow of a program is explicit in a program's source code. As a result, interprocedural control-flow analysis implicitly usually refers to a static analysis technique for determining the receiver(s) of function or method calls in computer programs written in a higher-order programming language. For example, in a programming language with
higher-order functions In mathematics and computer science, a higher-order function (HOF) is a function that does at least one of the following: * takes one or more functions as arguments (i.e. a procedural parameter, which is a parameter of a procedure that is itse ...
like Scheme, the target of a function call may not be explicit: in the isolated expression (lambda (f) (f x)) it is unclear to which procedure f may refer. A control-flow analysis must consider where this expression could be invoked and what argument it may receive to determine the possible targets. Techniques such as abstract interpretation, constraint solving, and
type system In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
s may be used for control-flow analysis.


See also

* Control-flow diagram (CFD) * Data-flow analysis * Cartesian product algorithm * Pointer analysis


References


External links

{{Commonscat, Control-flow analysis
for textbook intraprocedural CFA in imperative languagesCFA in functional programs (survey)for the relationship between CFA analysis in functional languages and points-to analysis in imperative/OOP languages