Theory of Programming Languages
Homework #1
Due: September 7, 2011
- In C/C++, you can increment a variable using any of:
x++;
x += 1;
x = x+1;
Do some research on these statements to answer the following questions such
as:
- Why have multiple ways of doing the same thing (non-orthogonality)?
- Why is the syntax x += 1; rather than x =+ 1; ? See if you can
track down a version of a language that actually did this.
- Is there any real difference with today's compilers? A bit of
programming can be done here (hint: look at the assembly/intermediate
language).
- What other factors come into play?
- Early versions of COBOL had a limited version of the IF statement.
Track down information on this limitation(s?) and report on it.
- The original designer of Java intentionally left user-defined operator overloading
out of the language. What was his reasoning? There are advocates
of putting this feature back into the language. Discuss the pros and
cons of doing so.
- Chapter 1, Problem Set. Problems 11, 12, and 18.
- Chapter 2, Problem Set. Problems 8, 11, 12, 14, 18, and 24.