As far as my understanding goes, compilers are meant for developers compiling their code into executable (machine-code) files. Compilers don't extend to a client's machine or end-user system.

Instead, developers just use the compiler to convert their code into machine code, which is then transported to the other machines for use as applications.

Do compilers have a function outside of this process? If so, when are they used?

  • 21
    Yes, compilers compile code. Commented Aug 30, 2011 at 14:34
  • @Tom : I read somewhere that C-compilers are installed on various machines, including gaming consoles. Does this mean we write code in C, then that is shipped to these devices, where are compiled by the compiler and then executed by interpreter ? Commented Aug 30, 2011 at 14:39
  • 3
    @Pankaj Upadhyay: It's possible that code could get sent to a machine and then compiled by an internal process. It's unlikely the user of the device would ever see this happening or know about it. It might be done if parts of code need to be compile for specific hardware and solutions that test for hardware at runtime are too slow, leading to the need to distribute code and compile during install. Maybe... Commented Aug 30, 2011 at 14:53
  • 3
    @Pankaj No game consoles ship with compilers, but some can be installed on them. Sony provided a version of Linux and GCC that could be installed on the PS2 for example. Other people have cracked/hacked their way to getting other OSs and software onto consoles.
    – IronMensan
    Commented Aug 30, 2011 at 14:54
  • 4
    @Stargazer: Did you mean: "No, compilers translate from a source language into a target language"? Omitting the comma makes your sentence mean the opposite of your intended meaning. Commented Aug 30, 2011 at 16:59

8 Answers 8


Yes and no. Yes, the classical scenario is a developer using a compiler to generate machine code from source code, and the machine code is then distributed to the users.

There are a few exceptions to this though. First, many open source projects are distributed primarily (or even exclusively) in source code form, and expect the end user to install them by typing in a couple of commands like make and then make intall. This will invoke the compiler, linker, etc., to generate the machine code from the source code for that users computer. In these cases, however, the process of building and installing is (at least intended to be) automated to the point that the user rarely needs much knowledge of it beyond the fact that if they've never installed a source code-only package previously, their package manager will typically list some "development" package as a prerequisite for installing the application they really care about (though some still see this as unfriendly to end users).

Another exception (that's been alluded to, but not explained very well in the other answers I've seen) is just-in-time (JIT) compilers. A couple of obvious examples of JIT compilers are the Microsoft Common Language Runtime (CLR) and the Java Virtual Machine (JVM). In these cases, there are normally two entirely separate compilers involved in translating source code into machine code. One is used by the developer. However, rather than generating machine code directly, it generates a machine-independent byte code. The CLR/JVM then includes a second compiler, entirely separate from the first, that converts those byte codes to machine code for the target computer.

I should add that the second compiler isn't strictly necessary. Early versions of the JVM (for one example) just interpreted the byte codes instead of compiling them. This often carries a fairly serious performance penalty though, so most reasonably recent JVMs intended for production use include a JIT compiler.


Yes, compilers are mainly used by developers, with a couple of notable exceptions. End users sometimes use compilers to compile and install the latest open source software, even if they don't make any changes to the code. Also, some programming languages don't have compilers. They use interpreters instead that "compile" on the fly. In that case, end users need to have the interpreter installed on their machines.

  • 4
    If we were to restrict the definition of "compilers" to mean programs that generate executable files, then this would be a good answer. However, that is merely a subset of the true definition of "compiler"
    – riwalk
    Commented Aug 30, 2011 at 15:13
  • 16
    @Jan Soltis: I disagree. I've compiled the Linux kernel from source: does that mean that I am a Linux kernel developer? I've never modified Linux kernel code or submitted a patch -- I would say that means I'm not a kernel developer. Plus, for the several years that I used Gentoo as my primary operating system, I compiled every single piece of software on the machine. However, the vast majority of those were compiled automagically by the Portage package management system. I would argue that in that case I was acting as an end user but not as a developer. Commented Aug 30, 2011 at 16:55
  • 8
    @Jan Soltis: I am aware that that is your opinion. I respectfully disagree. I provided counterarguments to support my position, while you continue to make unsupported assertions. You seem to think that there is a sharp line between "developer" and "end user" which I do not believe exists. Commented Aug 30, 2011 at 19:13
  • 6
    Downloading sources and then running "make install" is not being a developer. It is definitely an end-user operation. Commented Aug 30, 2011 at 19:44
  • 3
    @Jan: I could accept that using a distro like Gentoo that compiles packages makes you at least a power user, but that is still clearly a type of user. Compiling other people's code, without modifying it, adding to it, or even reading it, does not make you a developer. Commented Aug 31, 2011 at 3:37


A compiler is defined as a program that translates code from one language into another (see Wikipedia). The most common use of compilers is to translate the source language into machine code, but this does define the word "compiler".

For example, Python generates byte-code when it imports a module, and thus fits within the definition of a compiler (because it converts from the source language, Python, into the target language, Python byte-code).

Another example is the V8 JavaScript engine. It converts JavaScript into x86 machine code, and thus fits into the definition of a compiler as well. Not only does V8 fit the definition of a compiler, but it is included in Chrome and is very widely used on client machines.


One case would be for an application that dynamically generated code at runtime, and then ran the generated code. This code would need to be compiled at runtime.

Edit: There are other exceptions, but they had already been mentioned in other answers.

  • +1 just say JIT
    – gnat
    Commented Aug 30, 2011 at 15:21
  • 1
    The V8 engine in Chrome is not an oddball exception.
    – riwalk
    Commented Aug 30, 2011 at 15:22
  • Updated to clarify. I realize there are other exceptions.
    – user3792
    Commented Aug 30, 2011 at 15:38

compilers are meant only for developers for compiling their programming-language code to executable(machin-code) files

I would say "compilers are meant primary for developers ...". But I have seen examples where programs generate new programming-language code on-the-fly and therefore need a compiler to be installed on the end users machine. That does not mean the end-user has to work with the compiler by itself.

Possible reasons for this program design:

  • performance: think of a rule-driven application where the rules are stored in some kind of end-user data store and you have some mass-data to be processed by those rules. Instead of interpreting the rules again and again, a program generates the processing code first, compiles it and runs it against the data to be processed

  • think of a program where the end user can add some kind of math formula and the developer of the program does not want to implement his own parser/interpreter for this. Instead, the program takes this formula, makes some additions to transform it into a valid piece of program code, let the compiler compile it and runs it afterwards.

  • hmm.... That does not mean the end-user has to work with the compiler by itself. That pretty much explains and clarifies. Commented Aug 30, 2011 at 14:56

That's right -- compilers compile source code into executable form, which is then linked into an executable binary file by a linker. Source code can also be executed directly by an interpreter such as one of the many command-line shells (C-shell, bash, zsh, etc.), awk, sed, and so on.

It can be hard to draw a clear line between "developer" and "end user" unless you limit your discussion to a specific product. Developers are all "end users" of the tools they use, and "end users" may have development tools such as compilers and interpreters installed on their machines.

  • 2
    Ok, I'm going to -1 this one, because there is a lot of misunderstanding here about compilers. Compilers translate code from a source language into a target language. Saying they generate machine code is similar to saying that vehicles have 4 wheels (yes, most vehicles have 4 wheels, but a motorcycle is a vehicle too. In the same way, most compilers generate machine code, but a C# -> VB converter is a compiler as well)
    – riwalk
    Commented Aug 30, 2011 at 15:28
  • 1
    @Stargazer712, I assure you that there's no misunderstanding -- I know very well what compilers do, thanks. But if someone who doesn't know asks me what a car is, I'd probably say that a car has four wheels despite the fact that some don't. A pedantic definition often confuses more than it explains to a person trying to come to grips with a concept. "Compiler" can also be a job description, but mentioning that wouldn't help here.
    – Caleb
    Commented Aug 30, 2011 at 16:05

Administrators may also have a need for using programming languages in writing scripts to perform various automated tasks. For example, having a script that deletes old log files off a server after 90 days to free up some disk space. The language used to write the script has to be interpreted or compiled so that it can be run on the system.


Some programs are meta-programs: while running, they might generate some other program (or some source code) and compile it then run it somehow. Read also about multi-stage programming.

So to use these kind of programs, a compiler would be needed, even if the user does not know how to program himself (because the computer would generate some code which needs to be compiled).

For an example, see MELT (which generates C++ code to extend GCC) or J.Pitrat's CAIA artificial intelligence system (which generate C code -notably its own code- to solve combinatorial problems).

Also, some languages and some implementations nearly require a compiler to be present everywhere (in every program coded in that language & implementation). First, several web browsers contain a Javascript JIT engine (like V8). Also, most Common Lisp implementations -e.g. SBCL- contain a compiler (even useful to running applications, which might generate and evaluate expressions). Read also about homoiconic languages and Qine programs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.