Programming languages used by humans to communicate with a computer to complete certain task. A programming language can be defined as a set of statements written in High-Level programming language which get converted in to machine language (i.e.0’s and 1’s) by compiler or an interpreter that computer can understand and proceed with instructions.
Programming languages usually split into the two concepts as syntax and semantics.
Syntax refer to grammatically structure of the language. For example, in C language you have to take care to use of data types, tokens, how you use function, function syntax, function declaration, definition, initialization and calling of it.
Semantic concern to logic or concept of statements or meaning assigned to the symbols, characters and words.
Languages are often used to write programs. This programs are set of instructions for the computer that commands it to complete a task. Computer is an electronic device it can only understand 0’s and 1’s. All high-level programming languages are converted into 0 & 1’s combination for the computer to understand the instructions.
Content
- Types of programming languages
- Low-Level Language
- Machine Language
- Assembly Language
- High-Level Language
- Interpreted Programming Languages
- Compiled Programming Languages
- Functional Programming Languages
- Scripting Programming Languages
- Procedural Programming Languages
- Markup Programming Languages
- Object-Oriented Programming Languages
- Parallel Programming Languages
- Characteristics programming Languages
The translation of Language occurs in two ways:
- Compiled Languages: These programs are translated into machine language by the compiler once to create a new file containing the machine language instructions. This often create an executable file which can run on any supported platform without re-compilation.
- Interpreted Languages: These programs are translated at directly on run time. This means the program do not need to compile we need whole program whenever the program is executed.
Types of programming languages
Low-Level Languages
- Low level languages are the machine languages written using 0’s and 1’s directly understand by a Computer system.
- A low-level language can be defined as a building block for software mainly designed to control and handle all the hardware and give instructions to the Computer.
- Programs that are written in Low-level languages can convert to machine code without a compiler or interpreter.
- C/C++ languages are mostly used Low level languages.
Low level language further divided into two namely Machine language and Assembly language.
Machine Languages
- Machine Language is one of the low-level programming languages developed for communicating with a Computer.
- Machine code can be processed directly without a previous transformation by computer system.
- Machine code is written binary digits 0 & 1 which makes it easy to understand, enhanced processing speed to perform the operations.
- Machine language is a strictly numerical language which is intended to run as fast as possible.
- Machine code instructions use bits to represent operations, such as addition, subtraction etc. it is difficult to read and write, since it is far from human’s mathematical notation and its codes vary from computer to computer.
- Programmers never write programs directly in machine code, because it requires attention to numerous details and memorizing numerical codes for every instruction, and is extremely difficult to modify.
Learn more about Machine language at Wikipedia.
Assembly Languages
- Assembly Language a step further lowest level, much more readable contain short word of in English forms and also symbols which requires very little translation to assemble it to machine code.
- Assembly Language is the second generation programming language having almost similar structure and set of commands as Machine language.
- Each assembly code is specific to a particular computer architecture and operating system.
- Assembly code is converted into executable machine code by an Assembler and conversion process is referred to as assembly.
- It is useful in programming a computer to interact with input/output devices like printers, scanners, storage devices, and so forth.
Machine and assembly languages are requiring a programmer to manage explicitly all of a computer’s function such as features of data storage and operation. Whereas high-level languages give much relief from that headache and provide a notation that can easily written and read by programmers.
High-Level Languages
- The high level languages user friendly language for programmer to read, write and maintain computer code easily.
- HLL is the third generation language and are independent to a particular type of Computer and also require a translator like compilers and interpreters to convert from high level language to machine language.
- HLL language does not require to limit to hardware constraints when developing a program. Every program written in a high-level language must be interpreted/compiled into machine language before being executed by the computer.
- There are many high level programming languages like BASIC, C, C++, Java, FORTRAN or Pascal that are less independent and also enables the programmer to write a program.
Machine and assembly language belongs to first and second generation programming languages respectively.
A programming language that has complex operations such as arithmetic expressions, loops, functions, and so on that save the programmer from dealing with the machine instructions directly is known as a third-generation programming languages.
Every programming language furthers divided by their paradigm that are listed below.
- Interpreted Programming Languages
- Compiled Programming Languages
- Functional Programming Languages
- Scripting Programming Languages
- Procedural Programming Languages
- Markup Programming Languages
- Object-Oriented Programming Languages
- Parallel Programming Languages
Interpreted Programming Languages
An interpreted language is a programming language in which the programmer write code that can be executed line by line directly by interpreter, rather than being compiled into object code and executed by the CPU directly.
In simple interpreters execute code line by line, while modern interpreters will do Just in Time compiling (JIT), which caches the result of the conversion so that the code get executed directly without syntax analysis next.
Advantages of Interpreted Language:
- Toolchain not required to compile your code into an executable.
- Interpreter allow you to execute statements of the language in isolation of small portions of code as you learn the language.
- Code is portable as long as there is an interpreter on your platform your code should run.
- Easy to learn and require minimum programming knowledge to use.
- Automatic memory management.
- Complex operations can be performed in relatively small number of steps.
Disadvantages of Interpreted Language
- Interpreters execute codes more slowly than compiled code.
- Harder to debug because interpreted languages are not strongly typed that mean a declare variable used to store strings, numbers and the interpreter won’t tell you a thing about it.
- Source code required for customers to run the program which you can’t hide. For Open Source programs, this is not an issue.
- Interpreted languages provide limited access to low level code.
- Susceptible to Code injection attacks.
Compiled Programming Languages
A compiled language is a programming language whose instructions converted to machine code from source code. Whole program compile to an object code which executed by computer.
Advantages of Compiled Language
- Programs compiled into object code at compile time which make it faster than those translated at run time.
- Compiler would translate the entire source code into a machine language file.
- optimized for the target hardware.
- Compiler finds errors throughout the source code, and sometimes inform the programmer of the specific lines with errors.
Disadvantages
- Compiler mandatory
- slower than interpreters.
Functional programming languages
Functional programming is a programming paradigm in which the structure and elements of computer programs are divide in to blocks rather that whole code at one place and avoids changing-state and mutable data.
The output value of a function depends only on the arguments that are passed to the function while calling. This is in contrast to procedural programming which depends on a local or global state, which produce different results at different times when called with the same arguments at different program state.
Functional Programming is based on Lambda Calculus framework developed by Alonzo Church to study computations with functions. It defines that anything computed by lambda calculus is computable, equivalent to Turing machine in its ability to compute.
Concepts of functional programming:
- First-class and higher-order functions: These functions can take other functions as arguments or return them as results.
- Pure functions: The return value of these functions only determined by its input values, without observable side effects. It can only access what you pass it, so it’s easy to see its dependencies. Pure functions also make it easier to write parallel programs.
add(x, y) // function taking x and y as arguments
return x + y // returns addition of x and y without changing them
- Recursion: Function which call itself repeatedly until it reaches the base case.
long int fact(int n)
{
if (n >= 1)
return n*fact(n-1);
else
return 1;
}
- Variables are Immutable: variable once declared and initialized will not change.
Advantages of Functional programming
- Pure functions are easy to understand because they don’t change any states and depend only on the input given.
- Functional programming languages treat functions as values and pass them to functions as arguments making the code more readable and understandable.
- Testing and debugging is easier.
- They use immutable values making easier to find problems in programs written uses pure functions.
- It is used to implement concurrency because pure functions don’t change variables or any other data outside of it.
Disadvantages:
- Too many pure functions can reduce the readability of code.
- Using recursion can be intimidating.
- Immutable values and recursion may lead to decrease in performance.
Scripting Programming Languages
A Scripting language is designed for integrating and communicating with other programming languages. Scripting languages often used in combination with another programming language such as HTML, Java or C++.
These scripts are commonly used to add functionality to a Web page. These types of languages are called client-side scripting languages and server-side scripting languages that display or manipulate the data in a database, on the server.
Scripting languages are also referred to as very high-level programming languages, as they operate at a high level of abstraction. Most widely used scripting languages are JavaScript, PHP, VBScript, Perl, Python, Ruby, and ASP.
Major drawback of scripting languages is that executable code can be downloaded from a remote server to a web browser’s machine. Since they are text based making easy for other people to modify and thus break it.
Procedural Programming Languages
Procedural programming derived from structured programming based upon the concept of the procedure call. Procedures also known as routines, subroutines, or functions, that specifies a series of well-structured steps.
Procedural language is also termed as imperative language. The procedural language divides a program within variables, functions, statements and conditional operators. Procedures are implemented on the data and variables to perform a task.
Markup Programming Languages
A markup language is a language used to annotate a document embedding tags accurately syntactically distinguishable from the text. Whole idea of a mark up language is to avoid the formatting text as the tags in the mark up language serve the purpose.
All tag used in a Markup has a property associated to format the text. These tags are enclosed in angle-brackets (<>). Codes that appear at the beginning and end of the statement are known as semantic markup and describe the included text.
HTML is a widely used markup language and one of the document formats of the World Wide Web have pre-defined presentation semantics means their specification prescribes how to present the structured data.
Object-Oriented Programming Languages
Object-oriented programming (OOPs) is a paradigm based on the concept of OBJECTS aim to implement real world entities like inheritance, hiding, polymorphism etc in programming world.
The main aim of OOPs is to bind the data and functions together so that no other part of program can access this data except that function having permission to access it. An objects can be accessed and modify the data associated with it.
OOPs widely used by programming languages such as Object Pascal, C++, Python, Java etc. are multi-paradigm programming languages supports object-oriented programming.
Some of the widely used object-oriented languages are C#, Python, Java, C++, Dart, Swift, Scala, PHP, JavaScript, Ruby, Perl, Object Pascal, Objective-C, and Common Lisp.
Parallel programming Languages
In parallel programming, single tasks are divided into subtasks and computed independently and then aggregated to form a single coherent solution. Parallel programming is most effective for task that can easily broke down into subtasks e.g., factorization.
Learn more about Parallel Programming at Wikipedia.
Characteristics of a programming Languages
The popularity of a programming language depends upon the features that it provides to its users. Some important characteristics of a good programming language provided below.
- simple, easy to learn and use.
- Should be readable and human recognizable. overall simplicity provides a programmer with a clear, simple and unified set of concepts.
- Abstraction the ability to define and then use complicated structures in ways that allow many of the details to be ignored providing an ability to define the complex structure and then its degree of usability comes. These makes writing programs in object oriented language is much easier.
- A Programming language should have high efficiency as efficient code require less time and memory.
- A programming language should be well structured and should have features necessary for users to write their programs based on the concepts of structured programming.
- A programming language should an Integrated Development Environment(IDE) with all necessary tools for the development testing debugging and maintenance of a program.
- A Language should be consistent in terms of syntax and semantics.