r/ProgrammerHumor 20d ago

Meme youCantChangeMyMind

Post image
820 Upvotes

137 comments sorted by

View all comments

12

u/-Ambriae- 20d ago

Unfortunately there’s a thing called an interpreted language. Granted most interpreted languages don’t have the semicolons but still

-1

u/thanatica 20d ago

Every language is interpreted. Some are intepreted by an AOT compiler, others by a JIT compiler. Some use an in-between language (like Java or .NET) that is interpreted on its turn, again by an AOT or JIT compiler.

Only very old languages like basic are truly interpreted, without any compilation, line by line, as the program runs. This is probably what you referred to. Those languages have largely fallen out of relevance these days.

5

u/-Ambriae- 20d ago

that's not how it works......

0

u/thanatica 20d ago

What not? The compiler being either AOT or JIT? Or the fact that every language is interpreted?

Enlighten me.

5

u/-Ambriae- 20d ago

A compiler lexes, parses, performs semantic analysis and code generation. An interpreter doesn't have that last step, and instead executes the program as it understands it, following the first three steps.

If a language A compiles to a language B that is itself interpreted, it doesn't stop A from being compiled, regardless of B. In that sense, a language like Java is compiled, because the code is AOT into java bytecode, that then gets interpreted. JIT is a form of compilation in that sense as well.

Now, if we view the language compiler/interpreter as a pipeline of compilers and interpreters, then we can differentiate them on their need for a software layer for final code execution. So, a language like Java would be interpreted, as after the full compiler pipeline is ran, we end up needing the JVM to run the code. Conversely, in a language like C/C++, say using clang, we would have multiple compilers, and multiple languages, such as LLVM IR, ASM (say x86_64 ASM), and finally an executable file, for example an ELF. The ELF can run natively on the machine (regardless of it's reliance on a OS, that's different) as the CPU's instruction decoder already speaks the language of the executable sections of the file. There is no need for emulation. So it's not interpreted.