Different Types of Compilers

what a compiler is? The different types of compilers and the most common compilers that computer engineers, actually use so let’s get started.

Kind of explain exactly what kind of compilers computer engineers use I want to first kind of address the question and explain what a compiler is, to begin with so a compiler is computer software that translates or compiles high-level languages such as c plus and python into machine instructions that the CPU can read, you could also have different types of compilers where they will translate the high-level language into an intermediate language such as assembly language is one level higher than a machine but it is a lower-level language than you know python or c plus there is this thing called an assembler that will convert to this assembly language into this set of machine instructions, it depends on the type of compiler you’re running.

There are compilers that’ll just you know take the high-level language and immediately convert it to a set of machine instructions, and then there are other compilers that do that intermediate step where they convert from the actual high-level language to assembly language, and then there’s an assembler that translates or assembles the actual assembly language program into machine instructions if that makes sense it’s kind of a little confusing. But I can put a graph right here of what exactly I’m talking about so there’s a high-level language program right here and then here is the compiler and then whether or not you decide to have you know the assembly language or not you can have an assembly language program that you can then assemble into machine instructions or just go straight from the compiler to machine instructions.

The CPU can then read it and then execute the code do whatever you wanted it to do have the computer act or you know the software do the things you wanted it to do in the actual program, now that we got that out of the way we know what a compiler is I wanted to go over basically what the different types of compilers there are so the first type of compiler we have is the cross compiler and the cross compiler translates source code from different platforms and this is mainly used for embedded software applications so that way you can compile code across different platforms multiple platforms without having any issues.

binary code digital data numbers background

The next one is a source to source compiler it doesn’t generate any machine-level instructions, it just generates the source code from one high-level language to another, so if you want to convert your program to a different language or use a different programming language to finish up your program a source to source compiler is perfect for that and then there’s a one-pass compiler and this compiler basically translates, the entire source code all at once in one pass so when you execute the code it’ll compile the entire thing at once it’s basically in the name pretty self-explanatory then we have the thread of code compiler which takes the source code and translates the entire source code by converting the string to a designated binary code.

I can leave a link on more information about that I don’t I’ve never heard of this compiler before never really used, it either and I don’t think you’ll be using it as a computer engineer then we have the incremental compiler which goes through the source code of the program checks to see which lines have changed since the previous time it was compiled and then whatever lines have been changed since then it will translate those lines into machine instructions, it won’t translate the entire code it’ll only do the parts that have been changed basically then we have the source compiler and this is the part this is the compiler that translates the source code into assembly language and it won’t do the full process or go all the way to machine-level instructions. It’ll just go to assembly language program so that’s where you know like I said from earlier you can decide to have a source compiler or just stick with a regular compiler that’ll just translate the entire source code into machine instructions lastly of course.

we have the native compiler which translates the entire source code on the same platform as the program is made, if you’re running on a windows 10 it’ll create and generate machine instructions for that windows 10 platform the only downside is that you won’t be able to use this compiler for you know other platforms such as a mac or an android or have that machine instruction set run on the mac or android that’s the only downside really.

Honestly, it's not that big of a deal as long as you're running on the same platform you should be good and that's just the native you know compiler and those are basically.

I have it right here on the list those are basically all of the types of compilers that you’ll probably use or maybe not use like I said the only one that is a little weird to me and I don’t think you’ll be using is the threaded code compiler mainly because like I said I have never used it before and I’ve never heard of it before so it’s really unique uh maybe you might don’t know so yeah that’s what a compiler is and those are the different types of compilers.

Now i’d like to go into what type of compilers you’ll be using as a computer engineer and i know from just from personal experience, you’ll be using a gnu compiler so gnu gnu you’ll also be using i think gcc but that might be the same thing as canoe i’m not too sure about the distinction i can put a list right here on the names of the compilers that you might be using but once again i don’t know what they are exactly because i personally didn’t need to use them and from personal experience i didn’t have much uh exposure to that area but what i did have it was you know gcc gnu um going into the command line on windows 10 windows 7 whatever it may be and making the file with make auto make whatever it may be so that’s why i’m you know really stressing those ones as a computer engineer you are more focused on the hardware and understanding that more so than compiling the code on the program there may be a course or two probably in you know software engineering courses or programming courses you’ll probably be learning how to compile code? but then again you could have an ide platform that does all of that for you and then you can just look at the error output from there.

Honestly it just really depends on what you do i think if you’re a computer science student, you’d be more focused on what type of compilers you should use or not use but as a computer engineer it just wasn’t emphasized as much i think it’s important to only go over you know the compilers that you will be using as a computer engineering student, and from my experience you won’t be using any of them really like i said you’ll be probably running the code on ides or ide platforms and you’ll only be taking two programming languages or courses for the first two years of your undergraduate degree until you decide to go either the software track or the hardware track um, and if you go to software track again not very common i went the software track and i didn’t know much about compilers it was just kind of like a black box it was just kind of part of you know building and running a program you didn’t really we didn’t really have any tests or quizzes or any focus on that area but yeah um i just thought i would help kind of shed some light on what a compiler is basically and the different types.