Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Comments on What are the criteria to define if a programming language is compiled or interpreted?

Parent

What are the criteria to define if a programming language is compiled or interpreted?

+6
−0

Often I hear people saying that some language is either compiled or interpreted. Examples: "Java is compiled" or "JavaScript is interpreted" and so on.

What are the criteria to define languages as such?

History

0 comment threads

Post
+0
−5

if the code is compiled everytime before running, then it is interpreted.

If you get a ready executable binary and run it again and again then it is compiled.

Java is sorted of both. you get executable binary of byte code, but every running jvm compile it again to machine code before running.

History

1 comment thread

Welcome to Codidact! It looks like you're having a rough start here; I'm sorry to see that. That... (3 comments)
Welcome to Codidact! It looks like you're having a rough start here; I'm sorry to see that. That...
FractionalRadix‭ wrote 6 months ago · edited 6 months ago

Welcome to Codidact! It looks like you're having a rough start here; I'm sorry to see that.
That said, I think there's a mistake in your answer that you may want to address. If code is compiled every time before running, it's still compiled. You seem to be thinking of JIT - Just In Time compilation. In the strictest version of interpretation, a part of a program might not even be parsed until it is reached by the execution.
You may want to edit your answer to provide some more detail. It is generally appreciated if you do research for an answer and provide sources. (Careful if your source is AI though - it is useful but inherently unreliable!)
Anyway, I hope this will provide you with a little help. Codidact is a beautiful place but it is not always an easy one.

programAngel‭ wrote 6 months ago · edited 6 months ago

By "compile," I guess you mean translating to machine code and executing it. But that is what happens every time an interpreter runs. It translates the script into machine code and then runs it. But in the case of compilation, like in C, it creates a binary shared library or a file once, and then it is used again and again, without recompiling.

I insist that JIT is something used by an interpreter in order to improve performance, but I still would not call JavaScript a compiled language. The same goes for Python, though both of them often use JIT.

As for Java, it is divided. It creates compiled bytecode for the JVM once. It can be a class file, WAR, JAR, and so on. But then the JVM, which acts as an interpreter, compiles it every time again and again before executing it. This is different from a case like Go, where you compile once and then run it again and again.

I understand that most people disagree with my definition. But I fail to see a better definition than this.

programAngel‭ wrote 6 months ago · edited 6 months ago

in other word, interpreter always compile the code (including all step of compilation like parsing) and then run it. because the cpu run in any case can run only the machine code.

So to say that the difference is whether the code is compiled once and kept as compiled binary or the source code is used again and again sound to me that best definition whether something is compiler or interpreter.