Вы находитесь на странице: 1из 2

COP 5021 Program Analysis

January 15, 2014

Answers to
Homework 1: Introduction to Program Analysis
See the syllabus and listen in class for the due dates.
In this homework you will get an overview of program analysis and make some initial plans for your semester project.
If you wish, you can work in groups, and I recommend that for the semester project. However, but be sure to follow
the process described in the courses grading policy if you work in groups.
Read chapter 1 of our textbook: Principles of Program Analysis [1]. There are also some online resources about
program analysis listed on the course resources web page,
http://www.eecs.ucf.edu/~leavens/COP5021/resources.shtml. You can also look for new books or online
resources that are interesting. (Hint: to find new resources, look in Chapter 1 of the textbook for terms to search for.
You may find more material under the specific approaches, such as data flow analysis or abstract interpretation, than
under the general term program analysis.)

[Concepts] Give a very brief answer (a sentence or two, at most a paragraph) to answer the following.
(a) (10 points) What are the main ideas and goals of program analysis?
Answer: The main ideas are to use safe approximations (abstractions), and where necessary to trade
precision for efficiency.
The main goals are to support program optimization (avoiding redundant and superfluous computation) and
software validation (ensuring that a program does not produce incorrect results). Program analysis tries to
do this without using extra inputs from the programmer, and in acceptable time and space (at compile time).
(b) (10 points) Aside from optimizing compilers for programming languages, briefly describe one other area of
computer science in which the ideas and goals of program analysis might be usefully applied, and how the
ideas might apply in that area.
Answer: There are several areas, including database systems, where one might like to use these ideas in to
optimize queries. In software validation and verification, there are myriad uses, such as checking for the
consistency of specifications, or checking properties of code against specifications. The way this would be
done would be by applying the ideas from part (a), making (over-)approximations to the properties needed
to optimize queries. In verification and validation, the main way to proceed would be to have the analysis
check for errors (the negation of the safety property desired) and thus if no errors are found, the
soundness/safety of the analysis will guarantee the absence of errors.

2. (20 points) [ImproveTools] Write a short proposal (about 2 pages in length) for a semester project that involves
writing a static analysis tool to answer some question about software. This proposal should describe the problem
you wish to solve (including the programming language your tool will analyze), and why it is interesting. You
should also discuss any related work on this problem that you are aware of and why it does not solve the problem.
Then describe, as precisely as you can, what question your tool will answer. Give one or two brief examples to
illustrate the question. Explain why this question can be answered statically (without executing the code).
It is best if you restrict yourself to an intraprocedural analysis; that is, it is best if your analysis does not need to
use analysis results from outside of a given procedure (or method) when doing analysis on that procedure (or
The programming language you analyze cannot be the WHILE language of the textbook [1]. However, it may be
a very restricted (small) subset of a real language. Also, it will be best if you work with a language that is a
first-order language (without procedure or function values), like the WHILE language of the textbook, because
handling higher-order languages (e.g., Scheme or Haskell) is a topic that we will likely not cover in detail this
semester (but see chapter 3 of the textbook).
It is recommended that you meet with the instructor to discuss this proposal, and that you do so as a group if you
are working in a group. However, if you cannot do that, email can be used.

[1] Flemming Nielson, Hanne Riis Nielson, and Chris Hankin. Principles of Program Analysis. Springer-Verlag,