Design Criteria for Programming Languages

last updated 8/24/15
What are the goals of the language?  Below are a list of guiding principles in the design of programming languages. Most of which are listed in your textbook.
Principles may be conflicting.  No language can accomplish all goals.

Language Goals

During 1950s--1960s - Compile programs to execute efficiently. 

But today





General attributes of a good language

Clarity, simplicity, and unity - provides both a framework for thinking about algorithms and a means of expressing those algorithms 

Orthogonality -every combination of features is meaningful

Naturalness for the application - program structure reflects the logical structure of algorithm

Support for abstraction - program data reflects problem being solved

Ease of program verification - verifying that program correctly performs its required function 

Programming environment - external support for the language

Portability of programs - transportability of the resulting programs from the computer on which they are developed to other computer systems

Cost of use - program execution, program translation, program creation, and program maintenance




Efficiency of execution

This is the earliest of design criteria, because of small memories and slow execution.
 FORTRAN had (has) statements that resembled machine instructions.

GOTO (10,20,30,40,50),I  FORTRAN's "computed goto" 
IF(A(I) - MID) 20,30,40  FORTRAN's "arithmetic if"
x <<= 3 C's bit pushing operators





This is the quality of expressivity in a language. Writability should be clear, concise, quick and correct

 APL is an extreme case

A <- i 12 p 3 4 results in a 3x4 matrix initialized with consecutive integers:

[1 2 3 4]
[5 6 7 8]
[9 10 11 12]

 LISP has simple, writable syntax in that data structures and program structures use same syntax.

(f a1 a2 a3 ... an) is the statement and functional syntax (function name and arguments follow)
(+ 12 total)

(1 2 3 4 (5 6 ) 7 (9 10))) is a data structure that can represent a tree like structure, nested lists, matrices, etc.



The quality of a language that enables  the reader (even non-programmers) to understand the nature of the computation or algorithm.

 COBOL is the extreme example 

            VARYING I FROM 1 TO 10






Efficient executable code







Efficiency of translation

How fast is the compiler or interpreter?

Pascal is easy

Algol has some slow features  






Assurance that a program does not behave unexpectedly.
e.g. array bounds checking









This is the efficiency with which a translator can be written









The ease of which errors can be found and corrected and new features added
This supplants writability.
Consider C++, Java, Ada and Modula-3








The avoidance of special cases and generalizing related constructs into one construct

loop ... end loop

for i=1..n loop ... end loop

while cond loop ... end loop








Independent functions should be controlled by independent mechanisms

Example of Pascal's data types and input/output  (C is similar)

Data Type I/O
char yes
integer yes
real yes
boolean yes
enum no

Benefit of Orthogonality for Programmers




The consistency of appearance and behavior of language constructs

Pascal, for example








  keep it simple


Having enough features to be available as needed for the realm of applications




A measure of how well a language has features for slight variations








Machine independence (portability)

The features of a language should not be developed with a bias for a particular machine







Language violations of definition should not escape detection
  1. may have a mismatch of parameters to arguments
  2. reason for C prototypes






Regularity (consistency)

  Having consistency with accepted notations and conventions

FORTRAN classic (also example of orthogonal problems)
DO 99 I=1.100







The ability to add features to the language







Well Defined Descriptions

Syntax is defined with BNF and Extended BNF.  These well formed definitions are used directly in the translation process.

Attempts have been made to formalize the expression of semantics.  This has not made it into the main stream.

These issues will be taken up in the exercises and compiler labs.