Programming Languages

HOME Desktop Computing Programming Languages - Links Programming Languages - A List

Abstract

Human Languages play a very critical role among humans beings for communication, interactions and for things done through other humans. Similarly, with the arrival of computing systems, humans have to communicate with them as computers bring quite a number of exciting and innovative benefits for mankind. Thus having realized the need for computer-specific languages, they were designed and being used extensively in the last and present centuries. In this article, there is a discussion on languages and specially on programming languages.

 Languages - An Introduction

A language is a collection of strings over a fixed finite alphabet set. That collection of strings should be generated or recognized by a set of grammar rules. For instance, English is a language over the 26 English letters. Thus for a language, there needs a set of alphabet symbols and a set of grammar rules. There are two main classes of languages. They are formal and informal languages. Every formal language has to satisfy the grammatical rules strictly. But that is not the case with informal languages. That is, informal language may utilize a little flexibility or relaxation in forming language statements through its grammar. In other words, the grammatical rules are not strictly enforced in this kind of languages. The communication languages such as English, Tamil etc. belong to the sort of informal languages as these languages are mainly for human consumption. A human, being an intelligent animal, can somehow understand through abstraction mechanism, the wisdom through the knowledge gathered and the environment and act accordingly. Hence the relaxation of rules does not affect much in the case of communication languages.

The other main difference is that communication languages will give much importance to semantics, that is, the meaning, not for the grammar rules. But the programming rules for formal rules worry much about the grammar rules rather than the semantics. For instance,

the statement "A snake killed him" is syntactically right and semantically wrong. This is acceptable to be a formal language statement but not acceptable for an informal language.

Programming Languages

The languages, such as regular, context-free, context-sensitive, recursive, recursively-enumerable languages etc. are formal languages. Apart from these, programming languages, such as Java, C++ etc. are also formal languages as they have to follow the grammatical rules very strictly. They are totally inflexible unlike human communication languages. These languages are mainly for information processing systems such as computers. This strictness is because of the unintelligent nature of today's computing systems. The tools like interpreters and compilers are designed in such a way that they can understand the program statements through a set of predefined rules. Thus every programming language has to adhere strictly to the rules laid down for them.

There are a number of programming languages created for different purposes for different environments. The class of programming languages is further subdivided into two on the basis of their usefulness and competitiveness for a particular purpose. They are System programming languages and Scripting languages. For instance, C and C++ are two primary system programming languages. There are applications programming languages such as Java, the latest buzzword in the IT industry, for coding diverse applications, such as client and server applications in a client/server environment, distributed applications for distributed object computing environment, database, e-commerce and Web applications. The list of application areas is really vast and growing. Click here for an overview of Java Programming Language

System Programming Languages

System programming languages were introduced as an alternative to assembly languages. In assembly languages, virtually every aspect of the machine is reflected in the program. Each statement represents a single machine instruction and programmers must deal with low-level details such as register allocation and procedure-calling sequences. As a result, it is difficult to write and maintain large programs in assembly languages. Hence higher-level languages such as FORTRAN and ALGOL began to appear. In these languages, statements no longer correspond exactly to machine instructions; a compiler translates each statement in the source program into a sequence of binary instructions. Over time, a series of system programming languages evolved from ALGOL, including C, C++, Java.

System programming languages were designed for building data structures and algorithms from scratch, starting from the most primitive computer elements such as words of memory. System programming languages are strongly typed to help manage complexity. System programming languages are less efficient than assembly languages but they allow applications to be developed much more quickly. This resulted in complete absence of assembly languages for software development.

Higher-level Languages

System programming languages differ in two accounts from assembly languages. System programming languages are higher level and strongly-typed. The term "higher level" means that many details are handled automatically, so programmers can write less code to get the same job done. For example, register allocation is handled by the compiler so that programmers need not write code to move information between registers and memory, procedure calling sequences are generated automatically so that programmers need not worry about moving arguments to and from the call stack and finally programmers can use simple keywords such as "while" and "if" for control structures as the compiler generates all the detailed instructions to implement the control structures.

On average, each line of code in a system programming language translates to about five machine instructions, compared with one instruction per line in an assembly program. But it has been found that for a given task, assembly languages require three to six times as many lines of code as system programming languages. Thus system programming languages allow applications to be coded more quickly than assembly languages.

The second difference is that system programming languages are strongly-typed. That is, the programmer has to declare how each piece of information will be used and the language prevents the information from being used in any other way. In a weakly typed language, there are no priori restrictions on how information can be used and hence the meaning of information is determined solely by the way it is used, not by any initial promises.

Modern computers are fundamentally typeless. Any word in memory can hold any kind of value, such as an integer, a floating-point number, a pointer, or an instruction. The meaning of a value is determined by how it is used. If the program counter points at a word of memory then it is treated as an instruction; if a word is referenced by an integer add instruction, then it is treated as an integer; and so on. The same word can be used in different ways at different times.

In contrast, today's system programming languages are strongly typed. For instance, a) each variable in a system programming language must be declared with a particular type such as integer or pointer to string and it must be used in ways that are appropriate for the type, b) data and code are segregated; it is difficult if not impossible to create new code on the fly, c) variables can be collected into structures or objects with well-defined substructure and procedures or methods to manipulate them. An object of one type can not be used where an object of a different type is expected.

Typing provides many distinct advantages. Firstly, it makes bigger programs more manageable by clarifying how things are used and differentiating among things that must be treated differently. Secondly, compilers use type information to detect certain kinds of errors, such as an attempt to use a floating point value as a pointer. Thirdly, typing improves performance by allowing compilers to generate specialized code. For example, if a compiler knows that a variable always holds an integer value, then it can generate integer instructions to manipulate the variable; if the compiler does not know the type of a variable, then it must generate additional instructions to check the variable's type at runtime.

Thus system programming languages suits well for developing applications if they have to implement complex algorithms or data structures; if they have to manipulate large datasets, for example, all the pixels in an image, such that execution speed is very critical; and their functions are well defined and slow to change.

Object-Oriented (OO) Languages

Object-oriented programming is widely believed to represent the next major step in the evolution of programming languages. There are OO languages such as C++ and Java. OO features such as strong typing, inheritance, encapsulation and polymorphism are often claimed to reduce development time, increase software reuse and solve many other problems associated with software development through other paradigms such as procedural and structured models. OO supports reusability through development of powerful library packages. There is an overview on software development through OO methodologies.