What is Compiler: Definition and 91 Discussions

In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language). The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language, object code, or machine code) to create an executable program.There are many different types of compilers which produce output in different useful forms. A compiler that can run on a computer whose CPU or operating system is different from the one on which the code it produces will run is called a cross-compiler. A bootstrap compiler is written in the language that it intends to compile. A program that translates from a low-level language to a higher level one is a decompiler. A program that translates between high-level languages is usually called a source-to-source compiler or transcompiler. A language rewriter is usually a program that translates the form of expressions without a change of language. The term compiler-compiler refers to tools used to create parsers that perform syntax analysis.
A compiler is likely to perform many or all of the following operations: preprocessing, lexical analysis, parsing, semantic analysis (syntax-directed translation), conversion of input programs to an intermediate representation, code optimization and code generation. Compilers implement these operations in phases that promote efficient design and correct transformations of source input to target output. Program faults caused by incorrect compiler behavior can be very difficult to track down and work around; therefore, compiler implementers invest significant effort to ensure compiler correctness.Compilers are not the only language processor used to transform source programs. An interpreter is computer software that transforms and then executes the indicated operations. The translation process influences the design of computer languages, which leads to a preference of compilation or interpretation. In practice, an interpreter can be implemented for compiled languages and compilers can be implemented for interpreted languages.

View More On Wikipedia.org
  1. jim mcnamara

    What are the limitations of Codon, the new Python compiler?

    See this story here in a press release from MIT: https://news.mit.edu/2023/codon-python-based-compiler-achieve-orders-magnitude-speedups-0314 Basically, any working Python module can be compiled one time only, and then run 10+ times faster than interpreted code, with no further changes to...
  2. M

    C/C++ Issue with my compiler not using C++11 with CLion on a Mac

    The compiler is not using C++11 or greater on CLion. My CMakeLists.txt reads: cmake_minimum_required(VERSION 3.24) project(main) set(CMAKE_CXX_STANDARD 17) add_executable(main main.cpp) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") Any idea what's happening? C++11 worked when I...
  3. R

    Comp Sci Unfamiliar Compilation Errors In a Linked List Class (C++)

    Hi all. I'm working on my final project for a class. The assignment is to have a linked list of personal records, and then do some things with it. Right now I'm working on the linked list class "List.h". I've implemented a Person class "Person.h" as a composition of 3 subclasses "Address.h"...
  4. Chaitanya_90

    Fortran Help with these Fortran Compiler Errors please

    What is the reason for error while compilation
  5. suezxc6

    Need Help with Fortran compiler errors

    Summary:: so I am trying to compile this program and i keep on getting "Unterminated character constant beginning at (1)" and "invalid character in name" at the months section. what do i have to change to fix it? thanks program Lab6 implicit none character*9 month integer monthNum, pos...
  6. E

    Working on a compiler, need some opinions

    Hey fellow nerds and geeks! I'm working on a new version of my compiler, mainly to improve performance on the compiler itself as it was my first attempt at such a program. Since I've learned a ton on compiler design (probably not the best of methods, but hey, it works, right?), I've built a new...
  7. E

    What is the best compiler now for intensive calculations?

    What is the best compiler these days – for intensive calculations? My cherished Borland PASCAL Delphi compiler has been “obsoleted” for a very long time now by MS changing their application calls, etc. And please don’t say FORTRAN, unless it has been totally overhauled. I outgrew it around 1980...
  8. L

    C/C++ How to download LLVM/Clang C++ Compiler on GhostBSD?

    Hi, I recently installed GhostBSD on to one of my desktops. I want to use this GhostBSD machine for software development/coding. Obviously I want to program in C++ and I'm currently trying to download the clang compiler for BSD but it's being weird. I looked it up on YouTube but there weren't...
  9. opus

    Interpreter vs Compiler: What Are the Differences and Benefits?

    I'm learning Python in my introductory Computer Science class and I'm going over high-level languages- more specifically, Interpreters vs Compilers. To my understanding, when we write in a high-level language, which a computer does not understand, we write what's called a source code or source...
  10. Carl Loomis-Anderson

    Fortran Fortran77 data compiler problem

    So I am doing a chemical simulation of titans atmosphere and I have potentially 1000 data files to sort through to retrieve concentration values written in Double format. The issue is that each chemical has its own line with well over 80 columns (1993 currently, though it is subject to...
  11. Guidestone

    Why is my PIC 18F2550 not sending data when I tell it to?

    Hey guys. I got a project in which I'm working on right now and I got to use a microcontroller in it. The microcontroller is a PIC 18F2550 and I have to receive data whenever I send the 'a' character via the serial port(RS232). The data I'm suposed to receive is generated with the ADC from the...
  12. B

    How can link external libraries from the cmd?

    I am familiar with linking external libraries in IDE like Eclipse, Netbeans etc. But in my college they use use vim for programming on Linux. To learn more about vim editor I installed it on my home computer.I can compile basic C++ programs on it with one or two .cpp/.h files. I think it is...
  13. A

    Help in telling compiler to include header files for C

    For a program to use I have to compile some .c files which include #include''header.h'' statements and I have tried different commands to compile but it gives me errors like 'No such file or directory'. Here is start of my file named #include "einterp.h" while start of file looks like this...
  14. pairofstrings

    Language and Compiler built for Mathematics

    Hello, I want to know: 1. Compiler name built especially for doing full-fledged mathematics. 2. Langauge name built especially for doing full-fledged mathematics. 3. Integrated software development environment name built especially for doing full-fledged mathematics. 4. Language, compiler and...
  15. C

    How to write a compiler program for if then else statement?

    < Mentor Note -- thread moved to HH from the technical physics forums, so no HH Template is shown > I was given the following question to answer for my Automata class: function = if(condition) then statement else statement the gramma for this if-then-else is...
  16. E

    Logic question (handling inequalities in a BASIC compiler)

    Hey everyone, I have a logic question, though I'm not sure if this might belong in the math forum (probably not :P) Anyway, I'm writing a BASIC compiler for the Motorola 68k processor by reverse engineering a dead project/compiler (with permission from the author as he's abandoned it years...
  17. S

    Would this have been optimized by a compiler?

    I had a coding interview question that asked to write a function to determine whether one string is a substring of another. So I wrote public bool IsSubtring ( String s1, String s2 ) { // returns true or false depending on whether s1 is contained in s2 for ( m = s1.Length, int i = 0...
  18. avikarto

    Fortran [FORTRAN] FFT of delta function, issue w/ MKL & Intel compiler

    I am trying to program something using a backwards FFT, and am attempting to feed it a delta function as a test condition since this result is known. However, my results are nonsense compared to what is expected. It should be the case that if we have...
  19. 22990atinesh

    Understanding LR(0) Parser: Constructing Parsing Tables

    I've read SLR(1), LR(1) and LALR(1) parser. But what is LR(0) Parser, how can we construct parsing table for LR(0) parser.
  20. J

    C/C++ Compiler error do to too much "constness" in my C++ program?

    Can someone try compiler this and tell me what error you get and what it means? https://github.com/jamkin/CSS-Template-Generator/tree/master/CSS%20Template%20Generator I get Mod note: Removed the [ I ] tags and the [ color ] BBCode tags, and replaced with [ code ] tags. There were too many...
  21. STEMucator

    Why does the compiler do this?

    Homework Statement This is not really a homework problem, but something is just so far off about this I had to ask. Note this is written in C. Homework Equations The Attempt at a Solution Here's some simple code that computes values of ##\sin(x)## and ##\cos(x)## using their Taylor...
  22. J

    C/C++ [C++] COMPILER ERROR: error: expected ']' before ';' token

    [C++] COMPILER ERROR: "error: expected ']' before ';' token" I'm getting 3 errors on the line usi bA_indx_val = _booArr[indx/USI_BITS]; denoted in my code. error: expected ']' before ';' token error: expected primary-expression before ']' token error: expected ';' before ']' token Can't...
  23. Superposed_Cat

    C/C++ A good C++ compiler for windows 8

    I've tried downloaded three different compilers for c++ and none of them work, I have visual studio 2010 but c++ won't work on it. If someone could provide a link to a c++ plugin for it I would be soooo grateful. But anything is appreciated as long as it's free.
  24. B

    Prerequisites for operating systems and compiler design

    What would be the prerequisites for an operating systems course or for a compiler course? I am well-versed in C programming and digital circuit design but have very little knowledge of computer architecture. Would I be recommended to go through a text on comp arch before starting a text on...
  25. M

    Desperate Student - Fortran G77 Compiler Help

    I recently asked my professor if he had any research opportunities in the following semesters and he told me that I should download and play around with 'Fortran G77 Compiler' and get back to him. So, I've looked into it but didn't make much progress.First off, I'm confused with which program...
  26. B

    C/C++ What are some simple and free resources for a C++ compiler?

    It's been years since I last programmed in C++ and I want to brush up on it over the next couple weeks. Problem is I have no idea what's out there that I could use for programming/debugging C++ programs; the compiler I used before came on a CD with the textbook, but now I'm completely on my own...
  27. A

    Fortran Top Free FORTRAN Compiler for CFD Applications

    Hey PF, I'm looking for a free and reliable compiler for FORTRAN; the application will be for CFD. Unlike C++, FORTRAN compilers seem harder to find. If anyone can provide some insight besides "do a google search" that would be great, thanks.
  28. P

    C/C++ Why Does g++ Require -fpermissive for Default Arguments in Some Cases?

    I started using g++ and the command line on linux. In one section of my code, I provide a default argument for a function parameter. I'm just wondering why this sometimes brings up an error if i don't include -fpermissive when I'm compiling everything. As an example. This is the...
  29. B

    How is compiler software compiled?

    If a compiler using a particular programming language is used to compile software and convert it from text files to executable application files, then how is the source code written for the compiler itself compiled so that it will have its own executable files?
  30. A

    Fortran MPI using Intel Fortran compiler

    Hi everyone, I have a question about how MPI works. Currently I have a job running on MPI on the mode master_slave, I mean that every slave executes a separate task without communicate with the others slaves, once a slave-node finishes, it sends a warning to the master and then the master...
  31. A

    Setting Up G95 Fortran Compiler for Cygwin

    I was given a CD with fortran files as part of my senior year project (biology major here), that said in order to compile the code (using cygwin), to install 'cygwin' and 'g95' Fortran compiler. I think i got the 'cygwin' succesfully installed (after watching numerous youtube videos) on my...
  32. H

    Synthesis using synopsys design compiler

    Homework Statement Hi, I am trying to complie my counter (writen in system verilog) using synopsys design compiler. It comes out this error: The expression in the reset condition of the 'if' statement in this 'always' block can only be a simple identifier or its negation. (ELAB-303) ***...
  33. T

    What is the best compiler for a beginner learning C?

    I'm wanting to start learning C and I'm trying to find a good compiler. So far I've found a lot of C++ compilers and I'm not sure if it would let me write code in just C. I've downladed Visual C++ 2010 express, but the interface is kind of confusing me. I was wondering if anyone knew of a good...
  34. L

    C/C++ What is the difference between C++ and a compiler

    Hello, I would like to start programming in c++ and after doing a quick internet search, I'm not sure where to start. From what I've read, I know I need a compiler, but my confusion arises from the fact that I don't understand what the difference is between the language c++ and its compiler...
  35. stripes

    Comp Sci Fixing Java Compiler Error: ';' Expected

    Homework Statement So I'm trying to create a method in java. The method is supposed to take a string and use the rot13 method to hide the message. That is, it takes each letter and places it forward 13 letters, so a becomes n, b becomes o, etc. Now I'm pretty sure this method is at least...
  36. pairofstrings

    Do modern computers have compilers running in the background?

    I want to know if there is any compiler running in the background when I open applications such as MS office or calculator. Also, if there is any compiler running when I save any office documents or open web browser and start browsing. I get this doubt because I believe that all that is...
  37. G

    Fortran What is the Best Fortran Compiler for OSX?

    I am making the switch to OSX from Linux and am unable to find any solid reference to the best way to get gfortran onto my mac without using MacPorts? What (other?) compilers are people using on OSX? I will have xcode installed as I typically develop in C and am looking to target the new Mac...
  38. G

    F95 Compiler Question: Linking & Execution

    Hi guys, I am thoroughly unfamiliar with the fortran, but I have to use a software that based on f95 codes. In the user manual of the software it says that, this software involves compilation and linking of the following code segments and in the following order: a.f95 b.f95 c.f95...
  39. S

    C++ Compiler For Mobile Devices

    Many of us might have used compilers on our personal computers.But does anyone know of C++ compilers for handheld devices.They would help us compile programs on the go.
  40. Q

    Fortran How to Compile Fortran Code on Mac and Unix Systems?

    I have several fortran code files which can be correctly compiled and run in Windows XP using gfortran. But, when I use the gfortran 4.2.1 compile these files on Mac(10.6), the code files can be compiled, but, it reports errors when I run the compiled file. the error is related to the...
  41. PainterGuy

    C/C++ Turbo C++: Is it Any Good for Learning C++?

    hello, someone has recommedned to me to use compiler turbo c++... is it any good? what is your take? programming thingy is totally new thing to me...i want to learn c++ though i have no prvious backgrond in this area. your help is much aprreciated. thanx
  42. PainterGuy

    C/C++ C++ compiler to write not-very-complex DOS/text-based programmes

    hello, would you kindly recommend me some simple C++ compiler programme to write not-very-complex DOS/text-based programmes? I'm new to C++, is one supposed to write pseudo-code into the compiler or instructions in terms some high level language? kindly let me know. thanks.
  43. N

    Fortran Which Fortran Compiler is Best for Windows and Linux?

    Any suggestion for a windows Fortran compiler? I've seen many around but it is somewhat difficult to choose when you don't know much about the subject! If you have any suggestion for Linux feel free to add them anyway! Leo
  44. M

    Fortran Best fortran compiler for Windows 7?

    Due to research changes I have to switch from C++ to Fortran development. In the past I have used Microsoft development tools since they are free for students, but afaik they do not have similar software for Fortran, and the Intel software is a little too expensive for me to afford. Which...
  45. P

    What is the difference between a compiler and an interpreter?

    Hi, I have a very fundamental doubt in compiler and interpreter. Compiler converts the high level programming language into machine understandle form and interpreter does the same but as line by line. So when an interpretor converts the high level language into machine codes (line by line)...
  46. C

    Fortran Increase of array memory in gfortran compiler

    Dear colleagues My code in Fortran passes all data in one large vector. I increased the size of this vector for the maximum that the compiler accepts but still need more positions allocable to it. Is there any way I can increase the memory allocation of the compiler? Thank's
  47. S

    How much it useful to learn two compiler?

    hello As I am doing c programming course in this semester, our course instructor told today that we will use turbo C in theory class and visual c in lab to compile our written programmes.Now the question that arose in my mind, is it useful to learn to work with two compilers?In which way can...
  48. J

    Fortran Salford fortran library compiler error?

    Salford fortran library compiler error?? Dear all, I have install the NAG fortran library, firstly, I compile the fortran program by using the Salford Fortran compiler with NAG static Lib. Command Prompt by typing ftn95 -c ProgramName.f95 It got a few warning, not error. But I...
  49. L

    Fortran Need help installing fortran compiler

    Hi! I wanted to install a f77 compiler, I am running Win7 but also have WinXP, I installed MinGW 5.1.3 and did everything mentioned in this pdf (https://docs.google.com/viewer?url=http://www.pns.anl.gov/instruments/scd/subscd/Fortran_and_C.pdf) So, basically its an automatic installer, I...
  50. S

    F90 compiler and user defined types

    Hi I have a little issue with f90. I am a c++ programmer but I have to use fortran for this project. f90 the compiler does seem to distinguish between methods from user defined types. I have two types one "has a" instance of the other. Both have a methods named Print (with different typed...