# What counts as automatic program analysis?

I'm trying to understand the definition of program analysis on Wikipedia:

Program analysis is the process of automatically analyzing the behavior of computer programs regarding a property such as correctness, robustness, safety and liveness.

What is the meaning of "automatic" here?

Are parsers static analysis tools, since they will throw an error if they encounter syntactically invalid code?

Is running a program an example of dynamic analysis, since it will provide me with an output (though I still have to interpret it myself)?

What if I explicitly throw a this can't happen exception when the program reaches an invalid state?

What about using a debugger to pause execution?

There is no sharp formal definition.

"Static" denotes "before running the program".

"Dynamic" denotes "while running the program".

"Automatic" stands for "without the intervention of the user". For instance, Hoare logic can be used to prove program properties, but (at least in its basic form) it requires user-provided invariants. Abstract interpretation, instead, often results in a totally automatic analysis. Type checking is usually regarded as automatic, since the type checker does not (usually) ask the user to provide hints about, e.g., why a given expression has the given type.

Parsing is static, but it's such a preliminary stage that probably most people wouldn't consider as program analysis at all. If a text file does not respect the syntactic rules, it is not part of the programming language (a language being a set of strings, after all!), hence it is not even a program, hence parsing is not program analysis. I would not be very interested in the syntax errors reported by cc kitten.jpeg, for instance.

Observing the program when it is being run is definitely a "dynamic" approach. Using a debugger, observing fired exceptions fall in this category.

The key part of the definition, which you have not focussed on, is "analyzing the behavior of computer programs".

• Analyzing suggests more than just running, it suggests performing some computation on, or, "examining (something) methodically and in detail, typically in order to explain and interpret it." (Oxford Dictionary).
• It is the behaviour of the program that is analyzed. The syntax is not part of the behaviour. The type structure, for example, is an abstraction of the behaviour of the program. The memory allocation behaviour is another aspect of the behaviour of the program. And so forth.