News for hackers. Stuff that matters.
Re:Why I wrote a book about interpreters by haberman on Thursday December 01, 2016 @06:12PM (#13084511)
I think in everyday usage, the most common thing that distinguishes the two is that a compiler saves its output in some standard format that some other piece of software is expected to understand.

So for example, something like Babel for JS is considered a compiler, because its output is JavaScript, which is a standardized language.

On the other hand, Python is not usually considered a compiler, even though it writes .pyc files to disk, because its output is bytecode that only Python itself is expected to understand.

Even this is a little bit grey though, because we would say that Python contains a bytecode compiler as one of its components, but I don't think that most people would say that the Python binary is a compiler.

Re:Why I wrote a book about interpreters by bretthoerner on Thursday December 01, 2016 @06:40PM (#13084668)
> Python is not usually considered a compiler, even though it writes .pyc files to disk, because its output is bytecode that only Python itself is expected to understand.

I'd disagree, simply because this is exactly what javac does too.

Re:Why I wrote a book about interpreters by haberman on Friday December 02, 2016 @10:40AM (#13089452)
Java bytecode is standardized. So any JVM implementing the spec should be able to interpret the output of javac:

http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.htm...

Python bytecode on the other hand is not standardized: its bytecode is considered an implementation detail of CPython and can vary from version to version.

Your example reinforces my point.

Re:Why I wrote a book about interpreters by z92 on Thursday December 01, 2016 @08:56PM (#13085342)
But javac doesn't run it. It's run by "java". Therefore javac is called the compiler.

If things were such that "java" runs all .java files and creates those .class files as bytecode cache, then java won't have been called a compiler.

And similarly, if python had two different programs, one to create *.pyc files and the other runs it, the former one would have been called a python compiler.

Re:Why I wrote a book about interpreters by dismantlethesun on Thursday December 01, 2016 @09:46PM (#13085554)
Colloquial usage really diverges strongly from technical usage.

For example, CPython could be considered to technically be a virtual machine because it does garbage collection on dead objects since v 2.4 at least, rather than being pure reference counting.

Yet most people would call CPython a straight interpreter.

Re:Why I wrote a book about interpreters by pjmlp on Friday December 02, 2016 @03:11AM (#13086978)
Memory management is an implementation detail, doesn't have anything to do with being an interpreter or virtual machine.