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...
Consider two languages A and B where A is a context free language and B is...
Consider two languages A and B where A is a context free language and B is a regular language. Show that the set difference, A-B, must also be context free. Also show that B-A may not be context free
Convert the following pep/9 machine language program into an assembly code. Determine the output of this...
Convert the following pep/9 machine language program into an assembly code. Determine the output of this program if the input is ‘tab’. The left column is the memory address of the first byte on the line: 0000 D1FC15 0003 F1001F 0006 D1FC15 0009 F10020 000C D1FC15 000F F10021 0012 D10020 0015 F1FC16 0018 D1001F 001B F1FC16 001E 00
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)
Research two computer programming languages (python can be one of them) and explain what tasks the...
Research two computer programming languages (python can be one of them) and explain what tasks the languages are best suited for and the industry in which they are typically used. Include a code snippet. How has mobile computing changed your life? Describe the impact of mobile computing on programming. What are some commonly used mobile programming languages? How will computer information systems fit into your professional life?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT