Properties of Languages and Machines

Purpose

To give you an opportunity to evaluate your background for this course:

Due dates

You must complete the PEP tasks (individually), and then hand in the answers to the questions in this exercise (as a group) at the beginning of class on Monday, August 31. This assignment is worth 10 points.

Background

As an engineering professional, you will regularly be asked to estimate how much time and how many resources (e.g. people) will be needed to produce a deliverable. Your skill in carrying out this estimation task will strongly influence your professional success.

Reliable estimates require reliable data. The only way that you can estimate time and resources for a task is to know the time and resources required for similar tasks in the past. Each homework assignment illustrates important aspects of compiler technology and also provides an opportunity for you to develop personal baseline data for project planning.

This course deals with the problem of translating programs that are understandable to human beings into code that is understandable to a computer. In order to study this problem, you must have some understanding of the common properties of programming languages and computer architectures. You will gain a deeper insight into these topics as the course progresses, but you need to be able to discuss them intelligently before you can participate effectively.

One of the ways to measure your grasp of the material is to try to explain various aspects of languages and machines. In this assignment you are asked to give such explanations for specific features. The intent is not to test your memory, or your familiarity with a particular language or machine. Instead, we are interested in your ability to reason from descriptions in the literature, to see consequences of design decisions, and to express your conclusions clearly and convincingly.

If you have trouble understanding these question, if you don't know where to find relevant facts, or if you don't see how to frame your conclusions, please verify that you have satisfied the prerequisites for this course. You may also wish to discuss your background with the instructor in that case.

This and all subsequent homework solutions must be accompanied by a summary of your time estimates and the actual times you spent in various phases of the life cycle. To complete this summary, you need to keep a record of the time you spend on various tasks. Chapters 1 through 3 of Humphrey give an overview of the mechanics of this process. After gathering the information, enter it into the database for this course.

Lynn Carter has provided a general treatment of the personal software process and its relationship to this course. As a part of this discussion, he gives specific guidance on applying it to each of the homework problems. You should carefully read his advice for this assignment.

Task

There is a specific set of PEP tasks associated with this assignment. Complete your personal project plan and submit it via the web before proceeding to the remainder of the task specified in this section.

Answer the following questions. Feel free to consult any textbook, but remember that common languages have standard definitions and many textbook authors fail to adhere religiously to the appropriate standard when discussing the features of a language. They may feel that the standard is too complex for a student, or they may actually not be familiar with the standard themselves. Whatever the reason, the result may be misinformation.

As compiler writers, we must hold ourselves to a higher standard in order to ensure that we actually implement the defined language or clearly specify how we deviate from it. In particular, since we will be using C as our implementation language in this course, you should answer all questions about C with respect to ANSI/ISO 9899-1990. This document is available in the Engineering Library, and is permanently on reserve.

  1. Describe how the various steps in Humphrey's Figure 1.1 (page 5) might apply to your efforts to improve your estimation skills.

  2. A student in an elementary programming course has heard the terms visibility and lifetime (also known as ``scope'' and ``extent'', respectively). They know that the two terms mean different things, but are having some difficulty understanding exactly what the difference is. Explain these concepts using terminology that should be familiar to such a student. Give some C examples, in particular showing situations that illustrates the differences between the concepts.

  3. Figure 1.2 of Waite shows a VAX implementation of the Pascal program given in Figure 1.1. Here is a different implementation of that program:

    	CLRL	q
    	MOVL	m,r
    test:	CMPL	r,n
    	BLSS	exit
    	SUBL2	n,r
    	INCL	q
    	BR	test
    exit:
    

    Would you prefer one of these two implementations over the other? Carefully explain the reasoning behind your answer.

  4. Most programming languages allow procedures, and therefore need some mechanism for passing parameters to those procedures. A number of such mechanisms have been devised over the years: value, result, value/result, reference, and name are five of the better-known ones. Attack or defend the assertion that C uses exactly one parameter mechanism: value. (Your answer will be judged on the quality of your reasoning, not on the particular position you choose.)

  5. We know that conversion from real to integer generally involves a loss of information, but what about conversion from integer to real? State your answer in terms that could be understood by a student in an elementary programming class.

Complete your personal postmortem for this assignment and your personal project plan for the next assignment, and submit them via the web before class on the due date of this assignment. Your group must hand in one set of answers to the questions at the beginning of class on the due date.


Instructor
Revision 1.7 (1998/08/12 22:56:26)