Monday, October 6, 2014

Chapter 2 : Problem Set

Q6 : Make an educated guess as to the most common syntax error in LISP programs.
A    :
1. Semicolon (;) missing.
2. Unmatched parentheses.
3. Function prototype mismatch.
4. Undeclared variables.

Q7 : LISP began as a pure functional language but gradually acquired more and more imperative features. Why?
A    : The main reason why imperative features were put in LISP was to increase its execution efficiency.

Q8 : Describe in detail the three most important reasons, in your opinion, why ALGOL 60 did not become a very widely used language.
A   :
1. Excessive flexibility hurt ALGOL60 since languages that are difficult to learn were not as well received as languages with a more rigid structure.
2. Its association with BNF alienated the language as strange and complicated.
3. Lack of support from IBM, who was at the time the preeminent company for using computer languages.

Q9 : Why, in your opinion, did COBOL allow long identifiers when Fortran and ALGOL did not?
A    : COBOL is more of a reporting language than Fortran. Since Fortran handles calculations much better, there is not a real need for long identifiers. As a reporting language, COBOL uses long identifiers in tagging the source to the reports it is writing. Also, COBOL is the closest language to a fully, self documenting language, that it gets, and long identifiers provides one more case for it.

Q10 : Outline the major motivation of IBM in developing PL/I.
A     : The most important new developments were the following:
• The concept of block structure was introduced. This allowed the programmer to localize parts of programs by introducing new data environments, or scopes.
• Two different means of passing parameters to subprograms were allowed: pass by value and pass by name.
• Procedures were allowed to be recursive. The ALGOL 58 description was unclear on this issue. Note that although this recursion was new for the imperative languages, LISP had already provided recursive functions in 1959.
• Stack-dynamic arrays were allowed. A stack-dynamic array is one for which the subscript range or ranges are specified by variables, so that the size of the array is set at the time storage is allocated to the array, which happens when the declaration is reached during execution.

No comments:

Post a Comment