World's most popular travel blog for travel bloggers.

How does interpreting a script work?

, , No Comments
Problem Detail: 

Suppose I have a script (.vbs, for example) that is stored in a file. How does the code in the file get converted into machine instructions? What is between the vbs file and the processor?

Asked By : developer747

Answered By : Uday Reddy

"Scripting" languages are typically interpreted, not compiled. That means that there will be a program called the "interpreter" for that language, which reads the programs written in the language, and executes them. You can start reading about interpreters from the Wikepedia entry:

http://en.wikipedia.org/wiki/Interpreter_(computing)

A compiler, on the other hand, translates a program in the programming language into machine language, and lets the CPU execute the machine language program. The only reason for compiling instead of interpreting is for speed. The CPU can typically execute the translated machine language program about 10-100 times faster than any interpreter. The reason is that the CPU is implemented in hardware. Otherwise, there is nothing that a CPU can do that a program can't.

Interpreted programs runs slow as compared to compiled ones due to the difference in execution process.

Scripting languages are usually used for expressing high-level operations. For such things, the speed advantage of the CPU becomes much less significant. So, interpreting them can be competitive to compiling them.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/9945

0 comments:

Post a Comment

Let us know your responses and feedback