- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between Imperative languages and Functional languages in compiler design?
Imperative languages are those which facilitate the computation by mean of state changes. By a state, it means the condition of a computer’s random access memory (RAM) or storage. It is helpful to think of computer memory as a sequence of snapshots, each one capturing the values in all memory cells at a particular time. Each snapshot records a state.
When a program is entered, associated data exists in a certain condition, say an unsorted list off-line. It is the programmer’s job to specify a sequence of changes to the store that will produce the desired final state, perhaps a sorted list. The store involves much more than data and a stored program. It includes a symbol table, run-time stack (S), an operating system, and its CPU itself can be viewed as part of the initial state.
A functional language is a programming language built over and around logical functions or procedures within its programming structure. It is dependent on and is equivalent to mathematical functions in its program flow.
Functional languages change their basic structure from the numerical structure of Lambda calculus and combinatory logic. Erlang, LISP, Haskell, and Scala are the most famous functional languages.
|Imperative Languages||Functional Languages|
|Imperative languages are based on Von-Neumann Architecture.||The functional languages are not based on Von-Neumann Architecture.|
|The programmer is concerned with the management of variables and the assignment of values to them.||The programmer requires not to be concerned with variables because memory cells need not be abstracted into the language.|
|The imperative languages facilitate the computation using the state changes.||The functional languages facilitate the functions that the program represents, instead of only stating changes as the program executes, statement by statement.|
|It can increase the efficiency of execution.||It can decrease the efficiency of execution.|
|It is used for the laborious construction of programs.||Less labor required than programming in an imperative language.|
|It is a very clean syntactic framework.||It is a much more complex syntactic structure than imperative language.|
|Concurrent execution is difficult to design and use.||Concurrent execution is easy to design and use.|
|The semantics are difficult to understand.||The semantics are simple as compared with imperative languages.|
|The programmer should create a static division of the program into its concurrent elements, which are then written as functions. This can be a complex process.||Programs in functional languages can be broken into concurrent elements dynamically by the execution system, creating the process highly flexible to the hardware on which it is running.|
|An example of imperative languages includes C, C++, ADA, Pascal, etc.||An example of functional languages includes LISP, ML, scheme, etc.|
- What is the difference between Procedural and Non-Procedural Languages in compiler design?
- what is the hierarchical structure of programming languages in compiler design?
- Functional Programming Languages
- What are the attributes of programming languages in compiler design?
- What are the different benefits of using programming languages in compiler design?
- What is the difference between Java references and pointers in other languages?
- What is the difference between Definitions and Declarations in Compiler design?
- What is the difference between DFA and NFA in compiler design?
- What is the difference between SLR, CLR, and LALR Parser in compiler design?
- What are the relationships between programming languages and parallel architectures?
- What is Compiler Design?
- What is the difference between Compiler and Interpreter?
- Database Languages
- Computer languages
- What are the different computer languages?