University of California, Irvine
ICS 141
CHAPTER 1
Communications
Share With
University of California, Irvine
ICS 141
CHAPTER 1.8
1)Errors in a computer program can be classified according to when they are detected and, if they are detected at compile time, what part of the compiler detects them. Using your favorite imperative language, give an example of each of the following:
Consider again the Pascal tool set. After successfully building a machine language version of the Pascal compiler, one could in principle discard the P-code interpreter and the P-code version of the compiler. Why might one choose not to do so?
Imperative languages like Fortran and C are typically compiled, while scripting languages (in which many issues can’t be settled until run time) are typically interpreted. Is interpretation simply what one “has to do” when compilation is infeasible, or are there advantages to interpreting a language, even when a compiler is available?
Consider the gcd program. Does this particular example (look in the book to see it) compute the same result? If not, can you fix it? Under what circumstance would you expect one or the other to be faster?
Both interpretation and code generation can be performed by a traversal of a syntax tree. Compare these two kinds of traversals. In what ways are they similar/different?
In your local implementation of C, what is the limit on the size of integers? What happens during arithmetic overflow? What are the implications of size limits on the portability of programs from one machine/compiler to another? How does this differ from other languages?
The Unix make utility allows the programmer to specify dependencies among the separately compiled pieces of a program. If file A depends on file B and file B is modified, make decides that A must be recompiled, in case any of the changes to B would affect the code produced for A. How accurate is this sort of dependence management? Under what circumstances will it lead to unnecessary work? Under what circumstances will it fail to recompile something that needs to be recompiled?
Why is it difficult to tell whether a program is correct? How do you go about finding bugs in your code? What kinds of bugs are revealed by testing? What kinds of bugs are not?
Purchase A New Answer
Custom new solution created by our subject matter experts