0

From what I know a front-end is a GUI for a program or for a website that has a web application in the "back-end".

I am confused to ses that for the GCC (GNU C Compiler) there are many front-ends but it seems that there are different definitions for "front-end" in this context.

1 Answer 1

2

A GCC front end turns code into an intermediate, internal form used by GCC. A GCC back end turns this intermediate, internal form into the final form that the compiler outputs.

So, for example, if you have a C++ front end and a Java front end, you can accept input in C++ and Java. If you have an x86 back end and a MIPS back end, you can produce executables for both x86 and MIPS CPUs.

If you wanted to add Go support to GCC, you'd write a Go front end for GCC. Then you could compile Go code for every platform GCC supports.

If you wanted to add support to GCC for a new CPU, you'd write a new back end for that CPU. Then you could produce code for that CPU using every language GCC supports.

7
  • but i thought java compiles to bytecode that is portable and interpreted
    – yoyo_fun
    Commented Apr 11, 2017 at 22:22
  • It does. So Java is both a front end (source code has to be turned into an internal format) and a back end (internal format has to be turned into executable output). Commented Apr 11, 2017 at 22:36
  • i though java xode is never turned into executable but into code that is interpreted by java virtual machine
    – yoyo_fun
    Commented Apr 11, 2017 at 22:39
  • @yoyo_fun That's just a matter of definitions. IMO, if you don't need to parse it and can run it and it's not human readable, it's an executable. Commented Apr 11, 2017 at 22:41
  • but can java executables made by gcc be run without installing a java virtual machine?
    – yoyo_fun
    Commented Apr 11, 2017 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .