A programming language is simply a textual representation of abstract principles. It is not compiled or interpreted - it is just text.
A compiler will take the language and translate it into machine language (assembly code), which can easily be translated into machine instructions (most systems use a binary encoding, but there are some "fuzzy" systems as well).
An interpreter will take the language and translate it into some byte-code interpretation that can be easily translated into a binary encoding on supported platforms.
The difference between the two is when that change occurs. A compiler typically will convert the text to machine language and package it into a binary file before the user runs the program (e.g. when the programmer is compiling it). An interpreter will typically do that conversion when the user is running the program. There are trade-offs for both approaches.
The whole point here is that the language itself is not compiled nor interpreted; it is just a textual standard. The implementation details of turning that text into machine instructions is where the compilation or interpretation choice is made.
Answer from Zac Howland on Stack OverflowA programming language is simply a textual representation of abstract principles. It is not compiled or interpreted - it is just text.
A compiler will take the language and translate it into machine language (assembly code), which can easily be translated into machine instructions (most systems use a binary encoding, but there are some "fuzzy" systems as well).
An interpreter will take the language and translate it into some byte-code interpretation that can be easily translated into a binary encoding on supported platforms.
The difference between the two is when that change occurs. A compiler typically will convert the text to machine language and package it into a binary file before the user runs the program (e.g. when the programmer is compiling it). An interpreter will typically do that conversion when the user is running the program. There are trade-offs for both approaches.
The whole point here is that the language itself is not compiled nor interpreted; it is just a textual standard. The implementation details of turning that text into machine instructions is where the compilation or interpretation choice is made.
It's typically compiled, although there is of course nothing preventing people from implementing interpreters.
It's generally wrong to classify languages as either/or; what is the language going to do? It's just a spec on paper, it can't prevent people from implementing it as either a compiler or an interpreter, or some combination/hybrid approach.
I am in my third programing class in college, and we have only done C++ up to this point. My current class is on Java, and we are learning about how C++ is compiled and Java has a mixture of both compilation and interpretation. Some people are having a lot of difficulty with this idea, especially coming from JavaScript.
I understand that for a language to be interpreted, it means it is read line-by-line, converted, and executed right away; for a langauge to be compiled, it means that the entire source code is translated and the entire file is executed.
My questions:
But in practice (i.e. as in actual writing code and developing software), how are compiled languages and interpreted languages different?
Also, how is Java both? I haven't noticed any differences from using Java to using C++.
Is C # an interpreted language?
Is Objective-C an Interpreted or Compiled language? - Software Engineering Stack Exchange
Is Objective C compiled or interpreted?
In actual practice, what does it mean to say that a language is "interpreted" vs. "compiled", and how does Java relate to both?
Videos
In the context of computer languages, there is no official (or standard) definition of compile, translate and interpret.
Like Java, C# provides binary portability. See Slashdot | Interviews | C++ Answers From Bjarne Stroustrup (I assume you know who Bjarne Stroustrup is). In that he says:
The technical hardest problem is probably the lack of a C++ binary interface (ABI).
C and C++ do not have a binary interface, therefore they do not provide binary portability.
As has been said, C# is compiled into IL (providing binary portability) then during execution the IL is compiled into machine code. Since it becomes machine language during execution, it is usually as efficient as C++.
Note that C++ is not used for websites, I assume due to the security risk of the machine language.
No, it is compiled to IL :
What is "managed code"?
Is C# interpreted?
It is neither. Objective-C is a programming language. A programming language is an abstract concept. A programming language is a set of mathematical rules and definitions. Programming languages aren't compiled or interpreted, they just are.
Compilation and interpretation aren't properties of a programming language, they are properties of, well, a compiler or an interpreter (duh). Every language can be implemented by a compiler and an interpreter, and most languages have both compiled and interpreted implementations. In fact, the majority of modern language implementations utilize both an interpreter and a compiler in the same execution engine for maximum performance.
For Objective-C specifically, I know of three implementations: gobjc, clang and oscompiler, but a quick Google search turned up two more. Of those five implementations, three are compilers and two are interpreters.
From Wikipedia:
Some language specifications spell out that implementations must include a compilation facility; for example, Common Lisp. However, there is nothing inherent in the definition of Common Lisp that stops it from being interpreted. Other languages have features that are very easy to implement in an interpreter, but make writing a compiler much harder; for example, APL, SNOBOL4, and many scripting languages allow programs to construct arbitrary source code at runtime with regular string operations, and then execute that code by passing it to a special evaluation function. To implement these features in a compiled language, programs must usually be shipped with a runtime library that includes a version of the compiler itself.
I think clange (the main objec compiler) ship with a runtime library to achieve the dynamic nature of the objective-c the language.