3 ms·
They have very different outputs. Compilers produce programs, while interpreters produce answers. More specifically, compilers produce programs in another langu
by justinpombrio 10y ago
They have very different outputs. Compilers produce programs, while interpreters produce answers. More specifically, compilers produce programs in another language (stereotypically machine code), while interpreters run your program to get an answer.
If all you have are compilers, you can never run a program. All you can do is convert it between different languages. Fortunately your computer comes with an interpreter built in: you can think of your cpu as an interpreter for machine code, implemented in hardware.
- taneq 10y agoSo by this definition, an interpreter is a compiler plus a virtual machine, bundled together?
- cestith 10y agoIt can be but needn't be. You can evaluate straight from walking your AST. You can also transform from your AST into an output then run the output. Either one is commonly called an interpreter but the former is further to that end of a spectrum.