Question

In: Computer Science

Interpreter and compiler are two methods to convert high level languages to machine language. How Python...

Interpreter and compiler are two methods to convert high level languages to machine language. How Python and C++ language works?

Solutions

Expert Solution

Compiler and Interpreter both are used to convert the high level languages into machine languages.

The python uses both compiler and interpreter. After writing the source code (.py files)at first compiler will convert the source code into byte code. In python it is simply a translation. The byte codes generated by the compiler are in lower-level format and platform independent.

          After compilation it will generate a file (.pyc) where the byte codes are stored. Unlike JAVA after convertion into .pyc file the content of this file i.e/ byte codes will load into python runtime environment , where this will be interpreted by python virtual machine. In this state he byte code will read line by line and the codes will be executed. The bytecodes will execute automatically .

C++

In C++ first the source code will be compiled and the compiled instructions are stored in an object file(.obj). The first step of the compiler is to run the preprocessors with source code. Header files are not compiled rather these are included from the source files. Each and every header files are open during the compilation time(those are related with source file only.) . The preprocessor will create a translation unit by inserting the contents. After completion of preprocessor compiler will start its work and convert the lines into object codes to form the object code file. After creation of object code file then it will create an executable file to execute the codes.Now the .exe file will execute the codes.


Related Solutions

Add the result envidented by the python compiler. use python language. 1(a) A Give the output...
Add the result envidented by the python compiler. use python language. 1(a) A Give the output for the array([ 0, 1, 8, 27, 64, 125, 216, 343, 512, 729]) a. a[:6:2] = -1000 (ii) a[ : :-1] ) b. Display the values of 1D array using for loop?
 c. Write a code to print a 3D array?
 d. How to print the transpose of a 2D array?
 e Write a function to sort the array row and coloumn wise ?...
List the high-level benefits of programming languages and identify the particular language(s) which are most closely...
List the high-level benefits of programming languages and identify the particular language(s) which are most closely associated with each such specific benefit.
What is machine language and how does it process input written in different scripting languages? How...
What is machine language and how does it process input written in different scripting languages? How user input is converted to output (give a detailed example) CPU ALU BIOS GPU Volatile and Non-Volatile memory What is the role of the OS?
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
When languages allow separate compilation, the compiler must decide on the compilation order. How does the...
When languages allow separate compilation, the compiler must decide on the compilation order. How does the Java compiler make that decision?
how to convert Sudo Code to C language of these two functions MsgEnv * request_msg_env( )...
how to convert Sudo Code to C language of these two functions MsgEnv * request_msg_env( ) { search for free memory block in the queue of the free blocks(shown in the data structure section ); if (no memory block is available) { Block invoking process(Process_switching(); } else { update the data structure; return a pointer to the memory block; } int release_msg_env( MsgEnv * msg_env_ptr ) : { if (memory block pointer is not valid) return ErrorCode; Add memory block...
Given two languages A and B, let A/B denote the language {w | w x ∈...
Given two languages A and B, let A/B denote the language {w | w x ∈ A for some x ∈ B}. Show that if A is a context-free language and B is a regular language, then A/B is a context-free language. hint (construct PDAs)
Language: Python Implement the Book class as demonstrated below. You should not change the Book methods...
Language: Python Implement the Book class as demonstrated below. You should not change the Book methods and implementation as provided. The docstrings in the template contain descriptions of each method. >>> b=Book ( ' Code' , 'Charles Ptzold' 'Computing' , 2001) >>> b Book ( ' Code' , 'Charles Ptzold' 'Computing' , 2001) >>> str (b) ' Code : Charles Ptzold: Computing: 2001 ' >>> b. getTitle ( ) ' Code ' >>> b. getAuthor() ' Charles Ptzold' >>> b....
Discussion Topic: In a program written in a high level language, if an arithmetic error occurs...
Discussion Topic: In a program written in a high level language, if an arithmetic error occurs the program aborts and produces an error message that usually has the phrase "Arithmetic Overflow Error". This can happen in different circumstances such as: an illegal calculation was performed, such as trying to divide a number by zero the result of a calculation is a number that is too large or two small for the computer to store and in other circumstances as well....
Let's assume that, an application program calls a High Level Language library function to display a...
Let's assume that, an application program calls a High Level Language library function to display a string with red color in the monitor. Explain the steps executing the operation (from function call to low hardware level).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT