A Detailed Look at Interpreters, Compilers, and Logic Programming

Verified

Added on  2023/06/04

|8
|1756
|55
Essay
AI Summary
This essay provides a comprehensive overview of fundamental computer science concepts, including interpreters and compilers, which are essential for converting high-level programming languages into machine-readable code. It differentiates between interpreters, which translate code statement by statement, and compilers, which convert the entire program at once, highlighting their respective advantages and disadvantages. The essay also delves into combined compilation and interpretation techniques used by languages like JAVA, Python, and PASCAL. Furthermore, it explores logic programming languages, focusing on their use of formal logics and applications in artificial intelligence, and object-oriented programming, emphasizing key features like classes, data abstraction, inheritance, and polymorphism. Finally, the essay discusses hardware description languages (HDLs) and their role in designing electronic and digital logic circuits, providing examples and references to support the explanations. Desklib offers additional resources and solved assignments for students studying these topics.
Document Page
Running head: Computer science
Computer Science
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Computer science
1. Interpreter and compiler
Generally, while coding or writing a program, there are two languages which are used. One of
them is higher level language and the other one is low level languages. Higher level language is
one which is used by the programmer to write the program and to write the code and it is done in the
English language. But computer does not understand this language, computer only understands
lower level language or we can say binary codes that are in 0’s and 1’s. So, the higher-level
language is needed to be converted into binary codes. And this conversion is done with the help
of interpreters and compilers (Keppmann, Maleshkova & Harth, 2017).
Interpreters convert the program code written in higher level language into binary codes. It
translates one program statement at a time and hence takes less time to analyze the code but the
overall execution time of the code is higher. It clears means that the overall time taken is high at
the time of execution. Interpreters are more memory efficient as it does not generate any
intermediate object code. One of the best factors related to interpreter is that it does not translate the
code until the first error is analyzed, and hence debugging is easy. Programming languages like
python and Ruby uses interpreter as the converter.
Unlike interpreter, Compiler converts the entire program into lower level language. Because of
this the analysis time is more, but the total execution time is less. Compiler requires more space as
they generate the intermediate object codes which are further required to be linked. Debugging in
case of compiler is little harder as it compiles the whole program at a time. C and C++ languages use
compiler as language converters.
2. Combined compilation and interpretation
Compilation and interpretation are the techniques used for converting the program codes from
higher level language to lower level language. Compilation and the interpretation are the two
different processes used for this conversion of codes.
Compilation is a process of conversion of program code into lower level language by taking
whole code at a time. Compilation is done by using the program software known as compiler
which converts the program a whole and gives the output and shows if there is any error in the
program.
1
Document Page
Computer science
Sequentially, A programmer write a code in higher level language or a language which can be
understood by human and then this language is converted into lower level language which can be
understood by computers and these are binary codes, and this conversion is done either by
compilation or interpretation of codes. Compilation includes the conversion of Program code as
whole into lower level language, whereas interpretation involves converting a single statement of
program at a time (Turner, 2018).
There are programming languages as well which uses both compilers and interpreter as the code
conversion software. JAVA, Python, PASCAL are some of the programming languages which
uses compiler and interpreter both as the converter of higher level language into lower level
language. JAVA is also one of the example which uses compiler and interpreter as converters.
JAVA use compiler to convert JAVA source code into JAVA byte code and then JAVA just-in-
time converter or it can be said that JAVA interpreter is used to run the JAVA byte code (Bertrane
et al., 2015).
3. Logic programing language
Logic programming languages are the language which uses formal logics for the programming
purpose. It is based on the True, False logics of the statements. The main difference between
Functional Programming and Logical Programming is that, it has Mathematical style whereas
Logical Programming has logical relations. It has Clausal-Form Logics which is based on
assumption and conclusion with resolution interface.
PROLOG (Programming in Logic) is based on Logical Programming. It is widely used in the
advance research programs. Now a day it plays a vital role in Artificial Intelligence (AI), Machine
Learning (ML) as its build on facts and logics.
Some of the languages that are used for Logical programming are Absys, Alice, Answer Set
Programming (ASP) and CHIP (Julián-Iranzo & Rubio-Manzano, 2017).
Example
Dad (Charlie) = David
Mother (Charlie) = Julie
Mother (Julie) = Lizzy
2
Document Page
Computer science
Parent(x) = y if (dad(x) = y or mother(x) = y)
Grandparent(x) = parent (parent(x))
Grandparent (Charlie)
Then “LIZZY “can be considered as the answer.
4. Object oriented programming
Object oriented programming is the programming which makes the use of several objects in the
program. The programmer using object-oriented programming defines the data type which is used
along with the type of operation or it can be said that function that will be performed on that data.
Object oriented programming involves the use of real world objects. This binding of data with its
function is done so that no other function could work over that data or can access that data. Only
function to which the data is bind can access the particular data. Object are stored by having a
particular address and occupy a space in the memory. Object oriented programming works with
an aim to implement the real-world entities like Data abstraction, inheritance, polymorphism,
dynamic binding and message passing.
Some of the basic features of object-oriented programming are: -
Class: - Class is nothing but the category and the object which determines the property and
function of that object. It helps in identifying the overall property and the function.
Data abstraction: - Data abstraction is abstraction of properties or the features of the
particular object.
Inheritance: - Inheritance means inheriting the properties of one object or class to another
object
Polymorphism: - The process of using the object differently according to the data type
and type of class is called polymorphism.
Message passing: - Message passing is kind of passing the message from object-oriented
programming and other programming. It is basically a form of communication that is
used in parallel programming and also in the overall object oriented programming. In
3
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Computer science
this the messages are sent to the receipts so that data can be given accurately. It also helps
to give accurate message which can result to the overall accurate results (Singh &
Agrawal, 2018).
Example of Inheritance using JAVA
Class Parent Class {
Public void parent Method (){
System.out.println("PARENT");
}
}
Class Child Class extends Parent Class {
Public void child Method (){
System.out.println("CHILD");
}
}
Public class Example {
Public static void main (String args[]){
Child Class a = new Child Class ();
a. parent Method();
a. child Method();
}
4
Document Page
Computer science
}
Output:
PARENT
CHILD
5. Hardware description languages
Hardware description languages are the languages used in computer science to design the
electronic and digital logic circuits. Hardware description languages have its importance in the
hardware like Arduino boards, ICs, microchips and many more. Hardware description language
is same as the C language which are used control the electronic appliance by converting the
commands of the code into the signals that will make the appliances to response. CNC machines
(Computer numeric control machine) also use hardware description language for its operation. CNC
consists of an operating system which uses input as a program and converts the program in such a
manner which gives signal to the module of machine how to operate. Verilog, VHDL and system
are three most commonly used HDLs (Bouchami & Nabki, 2014).
Example of HDLs: -
Verilog behaveiral module for OR gate
Module or behaveiral (a, b, c);
Input a,b;
Output c;
Reg c;
Always@ (a,b);
Begin
If ((a I b)==1’b0)
5
Document Page
Computer science
Begin
C=1’b0;
End
Else
beginc=1’b1;
End
End
End module;
6
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Computer science
References
Bertrane, J., Cousot, P., Cousot, R., Feret, J., Mauborgne, L., Miné, A., & Rival, X. (2015).
Static analysis and verification of aerospace software by abstract
interpretation. Foundations and Trends® in Programming Languages, 2(2-3), 71-190.
Bouchami, A., & Nabki, F. (2014, June). Non-linear modeling of MEMS-based oscillators using
an analog hardware description language. In New Circuits and Systems Conference
(NEWCAS), 2014 IEEE 12th International, pp. 257-260. IEEE.
Julián-Iranzo, P., & Rubio-Manzano, C. (2017). A sound and complete semantics for a
similarity-based logic programming language. Fuzzy Sets and Systems, 317(6), 1-26.
Keppmann, F. L., Maleshkova, M., & Harth, A. (2017, September). Adaptable interfaces,
interactions, and processing for linked data platform components. In Proceedings of the
13th International Conference on Semantic Systems, pp. 41-48. ACM.
Singh, A., & Agrawal, A. P. (2018, January). LIPI: A Custom Object Oriented Interpreted
Programming Language. In 2018 8th International Conference on Cloud Computing,
Data Science & Engineering (Confluence), pp. 14-1. IEEE.
Turner, R. (2018). Computational Artifacts: Towards a Philosophy of Computer Science.
Springer.
7
chevron_up_icon
1 out of 8
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]