Huwebes, Hulyo 10, 2014

Structure of Programming Languages
notes in my SUBJECT ITE 236

I.  What is Programming Language?
 -   A programming language is a formal constructed languages designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs to control the behaviour of a machine or to express algorithms.
The earliest programming languages preceded the invention of computer and were used to direct the behaviour of machines such as jacquard looms and players pianos. Thousands of different programming languages have been created, mainly in the computer field, and many more still are being created every year. Many programming languages require computation to be specified in an imperative form (i.e., as a sequence of operations to perform), while other languages utilize other forms of program specification such as the declarative form (i.e. the desired result is specified, not how to achieve it).
The description of a programming language is usually split into the two components of syntax (form) and semantics (meaning). Some languages are defined by a specification document (for example, the C programming language is specified by an ISO Standard), while other languages (such as Perl) have a dominant implementation that is treated as a reference.

   A. Types of Programming Languages.
  • C
    An advanced programming language used for software application development. Originally developed by Dennis Ritchie at Bell Labs in the 1970's and designed to be a systems programming language but since then has proven itself to be able to be used for various software applications such as business programs, engineering programs, and even games. The UNIX operating system is written in C.
  • C++
    Descendant of the C language. The difference between the two languages is that C++ is object-oriented. C++ was developed by Bjarne Stroustrup at Bell Labs and is a very popular language for graphical applications.
  • Visual Basic
    A language developed by Microsoft based on the BASIC language . Visual Basic is used for creating Windows applications. The VBScript language (also developed by Microsoft) is based on Visual Basic.
  • Java
    A powerful and flexible language created by Sun Micro Systems that can be used to create applets (a program that is executed from within another program) that run inside web pages as well as software applications. Things you can do with Java include interacting with the user, creating graphical programs, reading from files, and more. Java is often confused with JavaScript, but they are two different languages. Learn Java at our Java tutorials section. 
II. Evolution of Programming Languages
     A. Early History
      The first programming languages predate the modern computer.
During a nine-month period in 1842-1843, Ada Lovelace translated the memoir of Italian mathematician Luigi Menabrea about Charles Babbage's newest proposed machine, the Analytical Engine. With the article she appended a set of notes which specified in complete detail a method for calculating Bernoulli numbers with the Analytical Engine, recognized by some historians as the world's first computer program.
Herman Hollerith realized that he could encode information on punch cards when he observed that train conductors encode the appearance of the ticket holders on the train tickets using the position of punched holes on the tickets. Hollerith then encoded the 1890 census data on punch cards.
The first computer codes were specialized for their applications. In the first decades of the 20th century, numerical calculations were based on decimal numbers. Eventually it was realized that logic could be represented with numbers, not only with words. For example, Alonzo Church was able to express the lambda calculus in a formulaic way. The Turing machine was an abstraction of the operation of a tape-marking machine, for example, in use at the telephone companies. Turing machines set the basis for storage of programs as data in the von Neumann architecture of computers by representing a machine through a finite number. However, unlike the lambda calculus, Turing's code does not serve well as a basis for higher-level languages—its principal use is in rigorous analyses of algorithmic complexity.
Like many "firsts" in history, the first modern programming language is hard to identify. From the start, the restrictions of the hardware defined the language. Punch cards allowed 80 columns, but some of the columns had to be used for a sorting number on each card. FORTRAN included some keywords which were the same as English words, such as "IF", "GOTO" (go to) and "CONTINUE". The use of a magnetic drum for memory meant that computer programs also had to be interleaved with the rotations of the drum. Thus the programs were more hardware-dependent.
To some people, what was the first modern programming language depends on how much power and human-readability is required before the status of "programming language" is granted. Jacquard looms and Charles Babbage's Difference Engine both had simple, extremely limited languages for describing the actions that these machines should perform. One can even regard the punch holes on a player piano scroll as a limited domain-specific language, albeit not designed for human consumption.

     B. Modern History
 
D 2.0
D 2.0 is like C/C++ a system-level language, but with garbage collection and integrates imperative object oriented programming with functional and concurrent programming (actor model).
Erlang
Erlang is a concurrent programming language with a functional language as it's core, strict evaluation and dynamic typing. It was designed by Ericsson to support distributed, fault-tolerant, soft-real-time, concurrent systems and has been used esp. in the telecommunications area.
Groovy
Groovy is an agile dynamically typed language extension of Java.
Fortress
Fortress is brand new specification of a next generation programming language specifically designed for high performance computing (HPC). It is very innovative, but not yet ready for practice.
Haskell
Haskell is a purely functional programming language. I wrote my diploma thesis about the implementation of geometrical algorithms in this language.
Python
Python is a multi-paradigm programming language that ´ incorporates imperative, functional and object-oriented features. Python has a dynamic type system.
Ruby
Ruby is a reflective, dynamic, object-oriented language and often used in web development.
Scala
Scala is a statically typed multi-paradigm programming language, that integrates features of object-oriented and functional languages. It is integrated into Java and .NET.


III. What is Programming Language Theory?

         Programming language theory (PLT) is a branch of computer science that deals with the design, implementation, analysis, characterization, and classification of programming languages and their individual features. It falls within the discipline of computer science, both depending on and affecting mathematics, software engineering and linguistics. It is a well-recognized branch of computer science, and an active research area, with results published in numerous journals dedicated to PLT, as well as in general computer science and engineering publications.
     
IV. Compiler vs. Interpreter

 Interpreter

      In computer science, an interpreter is a computer program that directly executes, i.e. performs, instructions written in a programming or scripting language, without previously compiling them into a machine language program. 

Compiler
   
      A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program.
     
InterpreterCompiler
Translates program one statement at a time.Scans the entire program and translates it as a whole into machine code.
It takes less amount of time to analyze the source code but the overall execution time is slower.It takes large amount of time to analyze the source code but the overall execution time is comparatively faster.
No intermediate object code is generated, hence are memory efficient.Generates intermediate object code which further requires linking, hence requires more memory.
Continues translating the program until the first error is met, in which case it stops. Hence debugging is easy.It generates the error message only after scanning the whole program. Hence debugging is comparatively hard.
Programming language like Python, Ruby use interpreters.Programming language like C, C++ use compilers.


V. Defining Syntax.
    A. The Character Set

      Character sets are the fundamental elements in a regular expression. A character set is a pattern that matches a single character.

    B. Syntax Group

    C.Syntax and Program Reliability
Program Reliability
   
    Ability of a computer program to perform its intended functions and operations in a system's environment, without experiencing failure (system crash).
Syntax Reliability