Advanced Programming Languages

Course in brief:

Lectures and class discussion on philosophy of different languages, and the design of particular language "components", often used in more than one language.

Design exercise (as a class) of a new language, proposed as an extension to C, or Java, to allow "Stream" parallelism to be exploited.

Required work:

Assigned exercises from text, a few of which require small programs to be written in "new' languages: Scheme, SML, maybe 1 other.

Team and individual programming assignments in Java or C++ and in the new language:

Extending my implementation of the language extensions which allow stream parallelism to be simulated;

Adding new extensions, either designed by your team, or by the class as a whole;

Writing one or two "sample problems" both in a "reference" implementation in Java or C++, and in the extension language.

An important component of these projects is a "test suite" of problems, whose answers can be checked; the computation part of each test run should be "timed" (or estimated by computation of a total work measure during execution).

Each such project should be accompanied by a report, describing the programmer's experience during program design (what alternatives algorithms did you try and reject, and why, what were the sorts of errors you made, and which were particularly hard to find and fix).

Periodic verbal and written progress reports on any multi-week project are required.

DISCUSS: Different work? Less/More?

Suggestions for what you want to get from this course

The course isn't set in concrete. As a first exercise, I'd like us to derive class suggestions that several of us think desirable. I need some indication of how many people agree to each, so...

Course goals (My suggestions):

1. Introduce and explain several "esoteric" language features which have been introduced into various programming languages. Define their function, and give at least one example of a problem which exploits each. These language features can be thought of as components, which could be introduced into a new language, or could be used as starting points for developing better features.

2. Experience the activities that go on during design of a new language.

    1. Read some of the recent research literature in the area of Programming Languages, apply it to the project.

YOUR GOALS?

Text:

Finkel's text gives terse descriptions of many language features, along with examples of fragments of at least 2 languages which use each feature. No one language is described completely, and the SYNTAX he uses is NOT the syntax of the particular language under discussion usually -- the emphasis is on the semantics of the language feature, with syntax regarded as of secondary importance.

My lectures are intended to explain some of these features, and to supplement the text, by introducing for discussion topics like the "goal" of each language's designer (either guessed at, or obtained from the literature), attempting to determine reasons for a language's "success" or "failure", discussions of language design philosophy (what makes a language a good one), and families of related languages. Many of these issues are controversial, and your ideas on these issues are important for class discussions.

Language Design

A language begins with a "goal" -- an idea the designer has for improving the programming task. The designer translates the overall goal into a "design" -- a specific scheme for achieving the goal. The design usually consists of an overall strategy for program execution, or for program design, together with specific "facilities" built in to the language that allow the programmer to specify the details of a program, while staying within the designer's scheme.

Example: AWK.

The language needs some way to indicate the use of each facility, and the time at which each indicated facility is to be applied.

Meaningful questions about the design of the language at this level include:

A programming language is necessarily "processed: in some way -- it specifies "execution" -- an action in which a run-time agent performs certain operations on input data, to produce output data. To achieve this, the source language is translated into a series of run-time actions that the machine can perform. This translation requires specifying the form of run-time data, how individual language facility operations are performed, and how specific items of data can be located in memory. Run-time algorithms for these tasks are needed, and define the "implementation" of the language. Meaningful questions about the implementation for the designer include:

Language evaluation

A programming language is designed to improve programmer productivity -- to allow correct, efficient programs to be designed, tested, and maintained more easily (that is, faster). There are many ideas on how to do this, and even on whether "correct" and "efficient" are the best ways to judge the final product. Some thoughts:

a. Syntax and semantics clear, easy to understand and reason about;

Supposed to encourage people to write, read, and discuss programs, demonstrate their correctness by informal reasoning, and improve their performance.

b. Minimize size of language manual, by building in only a small set of basic language constructs (compare LISP and PERL);

Supposed to reduce errors, by eliminating obscure language features and making the program's individual statements very simple.

c. Encourage or require the programmer to use some fixed programming paradigm, say OO.

d. Encourage the programmer to ignore efficiency of the program, since the search for efficiency slows the programming process, and encourages use of hard to understand coding schemes.

e. Build in every possibly language and data structure concept, so programmers won't have to build their own.

    1. Require "tell me twice" redundancy in programs: every variable must be declared, and separately initialized, before its use is allowed; e.g.

Tree T = new Tree;

operate on T.

g. Require that every variable declared outside a block be explicitly mentioned in and "import" statement (maybe with its full declaration repeated), before its use is allowed.

h. Eliminate most declarations by deducing the properties of each variable, based on how that variable is used.

i. Minimize reported errors by making most combinations of variables and operators meaningful.

WHAT PRINCIPLES OF LANGUAGE DESIGN DO YOU LIKE?

Language "power"

All GP PL's are capable of expressing the computation of any possible mathematical function; however, a given language won't make all possible WAYS of performing that computation equally convenient to use, or equally efficient for the machine to execute.

Defining a language

Syntax -- form of each valid program

Semantics -- Meaning of each valid program (a certain process, or a function of program inputs to program outputs)

Can the language be implemented? How efficient will translated programs be?

How useful will the language be? Expressive, easy to use, readable? Error-prone? Elegant?

Why define a new language?

    1. To make use of a new data structure easy;
    2. To encourage use of a new programming paradigm;
    3. To introduce new programming concepts, as whole units, rather than program structures put together from existing constructs. This allows the compiler to check their usage to see if it is sensible, and may allow optimizations that could not have been deduced otherwise.
    4. To correct perceived defects in an earlier language;
    5. To introduce notation common to a specific type of problem domain, thus making practitioners of that domain comfortable with the programming
    6. notation.
    7. To make using a new hardware feature (pixel-mapped display; parallel processing) conceptually easier than using the feature directly "at the low level";
    8. Others?

Language extension mechanisms:

Suppose you haven't included everything a programmer wants in your language. What is the programmer to do? A language can usually be extended by defining subroutines. The subroutines then conceptually extend the set of operations (facilities) present in the language. However, sometimes this mechanism by itself isn't adequate.

Language evolution

FORTRAN, LISP, ALGOL, C. LISP, PROLOG, ML. COMIT, SNOBOL, AWK, PERL.

Which LANGUAGES do you use? Which do you think are obsolete? Why? Are any useful, but only for specific jobs?