The developers of the Dart language tell that there is a virtual machine that executes statements written in Dart language. What is the difference between an interpreter and a virtual machine that executes a language?

Until now the virtual machines that I knew, like Java Virtual Machine, Common Language Runtime, and Dalvik all execute bytecode that has been previously compiled from a programming language.

How does it work a virual machine that executes directly a programming language?

3 Answers 3


It probably works just as a normal Virtual Machine just instead of translating bytecode into machine code it translates the language into machine code. This might be different from an interpreter by having a JIT compiler which starts to compile the code into machine language and keeps this code to be run while an interpreter translates into machine code each time an instruction is executed.


And how do you think the bytecode got created? Most probably something read the statements written in a language and converted it to bytecode. For example Java and C# compilers both do this.

Dart VM just skips this step and reads the statements directly. It is actually quite common for interpreted languages to do that. For example JavaScript and PHP were both like this before it became necessary to improve performance, and add the bytecode-generation step into the runtime process.

  • Thank you for the answer. I have modified my question adding the comparison with an interpreter. How does such machine compare to an interpreter? Commented Nov 16, 2013 at 7:25
  • 1
    @VitalijZadneprovskij There is no difference. Interpreters are usually virtual machines.
    – Euphoric
    Commented Nov 16, 2013 at 7:30

The 1K (not a typo) Basic for the earliest home computers, and their beefier descendents, worked by interpreting directly from the source code. Bill Gates was no slouch!

  • Not quite true. Atari BASIC, for example, internally stored statements in binary "tokenized" form. (I think GW-BASIC did too.)
    – dan04
    Commented Nov 16, 2013 at 19:39
  • CBM BASIC also stored a tokenized bytecode (of sorts).
    – greyfade
    Commented Nov 16, 2013 at 20:13
  • 1
    @dan04: I'd say you and ddyer are both right. The common microcomputer BASIC interpreters executed directly from source code which was stored in a slightly-compressed format. The fact that the code is slightly compressed doesn't make it "not source code", since the compressed form is the "official" editable version of the code.
    – supercat
    Commented Feb 16, 2014 at 22:42
  • One of my earliest memories of "they did what??" was with a pdp-8 basic, where the parser was clearly only using first letter plus length of keywords. print n could be written as plod on.
    – ddyer
    Commented Feb 17, 2014 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.