What converts vbscript to machine code?

Compiled languages, such as C # and java, have only time compilers that convert them (from byte code) to machine code (0 and 1). How is an interpreted language like VBScript converted to machine code? Is this done by the operating system?

+2
interpreted-language
source share
4 answers

They are not necessarily converted to machine code (and often do not).

The interpreter for this program performs the appropriate actions in accordance with what the program requires.

Some interpreters can generate machine code (using JIT compilers), others can stick with a simple script interpretation.

+2
source share

I know this is old, but given that I cannot comment (rep), I want to add an explanatory answer:

The interpreter is used to interpret the script (be it VBScript, javascript, python or any other script) into separate instructions. These instructions can be in the form of machine code or an intermediate representation (which the OS or other program can use). Some interpreters are made for something closer to assembler, and the source code is more or less directly executed.

Most modern scripting languages ​​(e.g. Python, Perl, Ruby) are interpreted as an intermediate representation, as well as an intermediate representation and compiled code (aka machine, aka object). An important difference (vs compiled languages) is that the interpreter does not accept the entire code of the code and translates its value into machine code, it takes each line at a time and interprets its value as a standalone block.

Think of it as the difference between translating an entire essay from English to Russian (compiled code) versus accepting each sentence in an essay and translating it directly (interpreted code). You can get a similar effect, but the result will not be identical. More importantly, the translation of the entire essay as a total amount of work requires much more effort than the implementation of a single sentence while a separate unit, but the entire translation will be much easier for Russian speakers to read than the rather clumsy sentences-licensed version. Therefore, the tradeoff is between compiling code and interpreting code.

Source: https://en.wikipedia.org/wiki/Interpreter_(computing) , experience

0
source share

This is the answer I was looking for. Like the javascript mechanism, the vbscript engine used to be used to turn human-like code into machine code. This vbscript engine is similar to the JIT compiler in the CLR and JVM. Only that it is converted directly from a human readable code into machine code. Unlike C #, which has an intermediate byte code.

0
source share

Referring to the VB Script wikipedia article ,

  • When VB Script is executed in the browser, it uses vbscript.dll to interpret the VB script.
  • When a VB Script file is executed from a command line or a batch file, then cscript.exe used to interpret the VB script.
  • When VB Script is used by Windows itself for various purposes, such as displaying error messages or yellow notifications in the right corner of the taskbar, then this is interpreted using wscript.exe , which is a Windows service.
0
source share

All Articles