What is the difference between Procedural and Non-Procedural Languages in compiler design?

Compiler DesignProgramming LanguagesComputer Programming

Procedural Languages

Procedural languages are command-driven or statement-oriented languages. A program includes a sequence of statements, and the implementation of each statement generates the interpreter to modify the value of one or more areas in its memory that enters a new state.

The format of procedural languages are

statement1;

statement2;

C, Pascal, FORTRAN, and equivalent languages are procedural languages. Each statement in the language communicates the computer to do something. A program in a procedural language is a list of instructions. For very small programs, no other arranging principle is required. Such language includes a sequence of procedures that execute when called. Each procedure includes a sequence of statements where each statement manipulates data that can be either local to the procedures, a parameter if from the calling procedure, or defined globally.

Non-Procedural Languages

In non-procedural languages, all the instructions are not written in a definite order. It is referred to as a declarative and functional language. The non-procedural language does not need writing traditional program logic. Users intensify on describing the input and output instead of the steps of the program. Examples of non-procedural languages such as Java, C++, SQL, RGP, etc.

Procedural LanguagesNon-Procedural Languages
The procedural languages are command-driven or statement-oriented.
The non-procedural languages are fact-oriented.
The programs in procedural language specify what is to be accomplished by a program and instruct the computer on accurately how the evaluation is completed.
The programs in non-procedural language specify what is to be done and do not state exactly how a result is to be evaluated.
Procedural languages are used for application and system programming.
Non-Procedural languages are used in RDBMS, expert systems, natural language processing, and education.
It is complex.
It is simpler than procedural.
These are imperative programming languages.
These are declarative programming languages.
The textual context or execution sequence is considered.
There is no need to consider textual context or execution sequence.
As an example of a program, the sorting is completed by defining in a C++ program all of the elements of some sorting algorithm to a computer having a C++ compiler. The computer after translating the C++ program into machine code or some interpretive intermediate code follows the instructions and produces the sorted list.
In a non-procedural language, it is essential only to define the features of the sorted list. From this description, the non-procedural language system can produce the sorted list.
Machine efficiency is good.
The logic programs that use the only resolution face serious problems of machine efficiency.
The procedural paradigm leads to a large number of the probable network between functions and data if there are many functions and many global data items.
There are no such connections present in the non-procedural paradigm.
An example of procedural languages is C, ADA, Pascal, C++, etc.
An example of non-procedural languages is Prolog, USP, SQL Scheme, etc.
raja
Published on 23-Oct-2021 11:26:54

Advertisements