Question Sheet for the course: "Comparative Programming Languages" 12 lectures by Martin Richards 1 a) Briefly discuss what developments have affected the design of computer programming languages over the period 1951 to the present day. b) List and give brief explanations of six features that you regard as important for a programming language to gain wide acceptance. c) Discuss the difference between a propietry and a consensus language standard. To what extent can a programmer expect a program that conforms to a standard generate identical results when run using different conforming compilers. d) Discuss some of the compromises that have to be made when writing a programming language standard. 2 Both FORTRAN and COBOL are languages that were designed in the late 1950s. Briefly state the application areas that they were designed to support and discuss whether it would be better to have one language that covered boths application areas. Why are these two languages still widely used? 3 Outline some of the innovations in ALGOL that made it such a significant and influential language. Why was it never as widely used as FORTRAN? 4 ALGOL provided call by name and call by value, Pascal allowed call by value and call by name reference, and ALGOL W provides call by name and a variety of others including call by result, and call by value result. Briefly describe the calling mechanisms mentioned above and discuss why most recent programming languages only provide one mode of parameter passing. 5 It is required to represent the parse tree of an expression such as 1+2*3 where the leaf nodes contain integers and the operators are ADD, SUB, MUL and DIV. Compare how you might do this in BCPL, ML and C, and illustrate your answer by outlining the code for an evaluation function eval that computes the value of such an expression represented as a parse tree. Syntactic errors will not be penalised, but your answers should be in the typical style of each language. 6 Write brief notes on the following topics relating to BCPL. a) The advantages and disadvantages of a typeless language. b) To what extent can programs in BCPL be written in an Object-Oriented style. c) The coroutine mechanism of BCPL, d) In BCPL implementations, a function can be represented by just its entry addresses, but in languages, such as ALGOL and CPL, a more complicated representation was necessary. Discuss the restriction in BCPL that makes this more efficient representation possible. 7 Briefly outline with the aid of small examples how Simula-67 Classes can be defined and used. How does the language support inheritance. What application area was Simula-67 aimed to support? Discuss whether the same area can now be supported equally well by more modern languaged such as C++ or Java. 8 Smalltalk is a language with an almost trivial syntax containing none of the usual constructs such as if-the-else and while-do found in many imperative languages. Give a brief outline of the main syntactic features of Smalltalk and show how conditional and repetative constructs can be encoded. Illustrate your answer by giving an interative version of the factorial function. Outline the differences between class and instance variables, and class and instance methods. 9 Many features in C++ were designed so that they could be implemented very efficiently. Select three such features that are present in C++ but not in Java. Discuss whether the extra efficiency obtained is worth the added complexity of the language.