Introduction to Programming Languages


1.   Introduction to Programming Languages


Programming language is an artificial language which we use to create programs. The programming language communicates with machine or today known as computer. Programming languages are used to create programs that control the behavior of a machine and to solve certain algorithms.
Description of the programming language is usually split into two components of syntax (form) and semantics (meaning). Some of the languages are defined by a specification document. For example C and C++ are defined by the ISO/IEC language standard. There are also variations of these languages such as C++/CLI programming language. This C++/CLI is a variation of C++ programming language developed by the Microsoft and incorporated in Microsoft Visual Basic software.

1.1.   Definition of programming language


A programming language is a notation for writing programs, which are specification of a computation of algorithm. Some authors restrict the term programming language to those programming languages that can express all possible algorithms. Traits often considered important for what constitutes a programming language include:
  • ·         Function and target,
  • ·         Abstractions and
  • ·         Expressive power


1.1.1.  
Function and target


A computer programming language is a language which we (humans) use to write computer programs. These computer programs involve some kind of computation or algorithm and possibly control external devices such as printers, disk drives, robots to perform an operation. It is generally accepted that a complete specification for a programming language includes a description, possibly idealized, of a machine or processor for that language. The difference between programming language and the natural languages is that the natural language is used for interaction between two people, while programming languages also allow humans to communicate instructions to machines.


1.1.2.                
Abstractions


Programming languages usually contain abstractions for defining and manipulating data structures or controlling the flow of execution. The practical necessity that programming language support adequate abstractions is expressed by the abstraction principle; this principle is sometimes formulated as recommendation to the programmer to make proper use of such abstractions.

1.1.3.                 Expressive power


The theory of computation classifies programming languages by the computation they are capable of expressing. All Turing complete languages can implement the same set of algorithms. ANSI/ISO SQL and Charity are examples of languages that are not Turing complete, yet often called programming languages.

1.1.4.                 Markup languages

A markup language is a modern system for annotating a document in a way that is syntactically distinguishable from the text. The idea and the terminology evolved from the Marking up of manuscripts, i.e., the revision instructions by the editors, traditionally written with a blue pencil on authors manuscripts. Examples are typesetting instructions such as those found in troff, TeX and LaTeX, or structural markers such as XML tags. Markup instructs the software displaying the text to carry out appropriate actions, but is omitted from the version of the text that is displayed to users. Some markup languages, such as HTML, have pre-defined presentation semantics. This means that their specification prescribes how to structured data are to be presented; while other programs such as XML do not.
So markup languages such as XML, HTML, or troff, which define structured data, are not generally considered programming languages. Programming languages may however, share the syntax, with markup languages if a computational semantics is defined. XSLT, for example, is a Turing complete XML dialect. Moreover, LaTeX, which is mostly used for structuring documents, also contains a Turing complete subset.

1.2.   Elements of the programming language


All programming languages have some primitive building blocks for the description of data and the processes of transformation applied to them. These primitives are defined by syntactic and semantic rules which describe their structure and meaning respectively.

1.2.1.                 Syntax


Syntax is a programming language form. Most of the programming languages are purely textual and they use sequences of text including words, numbers, and publication, much like written natural languages. On the other hand, there are some programming languages which are more graphical in nature, using visual relationships between symbols to specify a program.
The syntax of languages describes the possible combinations of symbols that form a syntactically correct program. The meaning given to a combination of symbols is handled by semantics. Since most languages are textual, this article discusses textual syntax.
Programming language syntax is usually defined using a combination of regular expression and Backus – Naur Form for grammatical structure.
Not all syntactically correct programs are semantically correct. Many syntactically correct programs are nonetheless ill- formed, per the languages rules; and may, depending on the language specification and the soundness of the implementation will result in an error on translation or execution. In some cases, such programs may exhibit undefined behavior. Even when the program is well-defined within a language, it may still have a meaning to a grammatically correct sentence or the sentence may be false:
·         Colorless green ideas sleep furiously. Is grammatically well – formed but has no generally accepted meaning.
·         John is a married bachelor. Is a grammatically well-formed but expresses a meaning that cannot be true
.

1.2.2.                 Semantics


The term semantics refers to the meaning of the programming languages, as opposed to their form (syntax).

1.2.2.1.                      Static semantics


The static semantics defines restrictions on the structure of valid texts that are hard or impossible to express in standard syntactic formalism's  For compiled languages, static semantics essentially include those semantic rules that can be checked at compile time. Examples include checking that every identifier is declared before it is used or that the labels on the arms of a case statement are distinct. Many important restrictions of this type, like checking that identifiers are used in the appropriate context, or that subroutine calls have the appropriate number and type of arguments, can be enforced by defining them as rules in a logic called a type system. Other forms of static analyses like data flow analysis may also be part of static semantics. Newer programming languages like Java and C# have definite assignment analysis, a form of data flow analysis, as a part of their static semantics.

1.2.2.2.                      Dynamic semantics


Once data has been specified, the machine must be instructed to perform operations on the data. For example, the semantics may define the strategy by which expressions are evaluated to values, or the manner in which control structures conditionally execute statements. The dynamic semantics of a language defines how and when the various constructs of a language should produce a program behavior. There are many ways of defining execution semantics. Natural language is often used to specify the execution semantics of languages commonly used in practice. A significant amount of academic research went into formal semantics of programming languages, which allow execution semantics to be specified in a formal manner. Results from this field of research have seen limited application to programming language design and implementation outside academia.

1.2.3.                 Standard library and run-time system

Most of programming languages have an associated core library which is sometimes known as the standard library, especially if it is included as a part of the published language standard. This library is conventionally made available by all implementations of the language. Core libraries typically include definitions of commonly used algorithms, data structures, and mechanisms for input and output.
A language core library is often treated as a part of the language by its users, although the designers may have treated it as a separate entity. Many language specifications define a core that must be made available in all implementations, and in this case of standardized language.

1.3.   Design and implementation


Programming languages share properties with natural languages related to their purpose as vehicles for communication, having a syntactic form separate from its semantics, and showing language families of related languages branching one from another. But as artificial constructs, they are also differing in fundamental way from languages that have evolved through usage. A significant difference is that a programming language can be fully described and studied in its entirety, since it has a precise and finite definition. By contrast, natural languages have changing meanings given by their users in different communities. While constructed languages are also artificial languages designed from the ground up with a specific purpose, the lack the precise and complete semantic definition that a programming language has.
Many programming languages have been designed from scratch, altered to meet new needs, and combined with other languages. Many have eventually fallen into disuse. Although there have been attempts to design one universal programming language that serves all purposes, all of them have failed to be generally accepted as filling this role. The need for diverse programming languages arises from the diversity of contexts in which languages are used:
  • ·     Programs range from tine scripts written by individual hobbies to huge systems written by hundreds of programmers.
  • ·     Programmers range in expertise from novices who need simplicity above all else, to experts who may be comfortable with considerable complexity.
  • ·  Programs must balance speed, size, and simplicity on systems ranging from microcontrollers to supercomputers
  • ·  Programs may be written once and not change for generations, or they may undergo continual modifications
  • ·    Programmers may simply differ in their tastes: they may be accustomed to discussing problems and expressing them in a particular language.

One common trend in the development of programming languages has been to add more ability to solve problems using a higher level of abstraction. The earliest programming languages were tied very closely to the underlying hardware of the computer. As new programming languages have developed, features have been added that let programmers express ideas that are more remote from simple translation into underlying hardware instructions. Because programmers are less tied to the complexity of the computer, their programs can do more computing with less effort from the programmer. This lets them write more functionality per time unit. Natural language processors have been proposed as a way to eliminate the need for a specialized language for programming. However, this goal remains distant and its benefits are open to debate. 

1.3.1.                 Specification


The specification of a programming language is intended to provide a definition that the language users and the implementations can use to determine whether the behavior of a programs is correct, given its source code.
A program language specification can take several forms, including the following forms:
  • ·         An explicit definition of the syntax, static semantics, and execution semantics of the language. While syntax is commonly specified using a formal grammar, semantic definition may be written in natural language, or a formal semantics
  • ·         A description of the behavior of a translator for the language. The syntax and semantics of the language have to be inferred from this description, which may be written in natural or a formal language.
  • ·         A reference or model implementation, sometimes written in the language being specified. The syntax and semantics of the language are explicit in the bahvior of the reference implementation

1.3.2.                 Implementation


An implementation of a programming language provides a way to execute that program on one or more configurations of hardware and software. There are, broadly, two approaches to programming language implementation, and that is: compilation and interpretation. It is generally possible to implement a language using either technique.
The compile output may be executed by hardware or a program called an interpreter. In some implementations that make use of the interpreter approach there is no distinct boundary between compiling and interpreting. For instance, some implementations of BASIC compile and then execute the source a line at time.

Programs that are executed directly on the hardware usually run several orders of magnitude faster than those that are interpreted in software. Just in time compilation is one technique for improving the performance of interpreted programs. This just in time compilation is based on the virtual machine, and just before execution, the virtual machine translates the blocks of byte code which are going to be used to machine code, for direct execution on the hardware
Share on Google Plus