Each programming language has a set of formal specifications concerning syntax, vocabulary, and meaning.
The specifications usually include
- Data types
- Data structures
- Instruction Set
- Control flow
Programming languages are designed on a specific design philosophy.
Data types
All data in modern digital computers are stored simply as zeros or ones in binary form. The data typically represent information in the real world such as names, numbers and yes or no values called data types.
As an example numbers are sub divided as integers and double. Integers range in value from -2,147,483,648 through 2,147,483,647. They are further sub divided as byte, short and long integers. Byte (0-255), Integer (32,768 to 32,767) etc. The double (-1.79769313486231570E+308 to9 4.94065645841246544E-324) type used for decimal numbers.
Object oriented languages allow the programmer to define data-types called "Objects" which have their own intrinsic functions and variables which are called methods and attributes respectively.
Instruction and control flow
Once data has been specified, the machine must be instructed how to perform operations on the data.
data are manipulated by instructions using branches, functions etc
Compilation and interpretation
- There are mainly two approaches to execute a program written in a given language.
- Compilation done by a compiler
- interpretation done by an interpreter.
- Some programming languages support both interpretation and compilation.
- An interpreter parses a computer program and executes it directly following the instructions of line-by-line.
- A compiler first translates the program into machine code understood by the processor. The compiled programs can be run by itself.
Compiled programs usually run faster than interpreted ones, because the overhead of understanding and translating the programming language syntax has already been done. (C++)
- Interpreters are frequently easier to write than compilers, and can more easily support interactive debugging of a program. (VB, Python)
- Many modern languages use a mixture of compilation and interpretation. (VB)