Java and C – What Stops C from Being Compiled, Interpreted, or JIT’ed?

ccompilerinterpretersjavajvm

Java is often praised for its amazing portability, which I presume is because of the JVM. My question is what stops C from being being compiled/interpreted/JIT'ed.., if so, C can also be write once and have it work on what ever device you have. but this is not a popular mechanism for processing a C program.

What are the disadvantages of processing C in this way, also what are the advantages of processing Java in this way and not compiling to machine code, other than the portability of course?

Best Answer

C is what I would call a mid-level language. Its purpose is to serve as a "very high-level assembler," which is why it works so well as a compiler target, and why it embraces portability so well.

Historically, interpreters have typically been used with high-level languages, in the context of method calls. In its simplest form, an interpreter merely parses each keyword in the source language along with its associated tokens, and converts that into method calls and parameters. In practice, what most interpreters do is convert the source language into some intermediate representation, and it is that representation that is interpreted.

What stops C from being interpreted or Jitted? Nothing. But that's not C's raison d'ĂȘtre.

Related Topic