A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code).

learn more… | top users | synonyms

46
votes
9answers
19k views

Are Intel compilers really better than the Microsoft ones? [closed]

Years ago, I was surprised when I discovered that Intel sells Visual Studio compatible compilers. I tried it in particular for C/C++ as well as fantastic diagnostic tools. But the code was simply not ...
14
votes
6answers
3k views

Why C++ to write a compiler?

I was wondering why C++ is a good choice to write a compiler. Of course C is good for this purpose too, because many compilers are written either in C or C++ but I am more interested in C++ this time. ...
2
votes
4answers
324 views

Integer sign and compilation via C

I'm writing a compiler that uses the time-honored strategy of using a C compiler as the back end, and I'm trying to figure out exactly how to handle integer sign. I'm using machine word integers as ...
7
votes
9answers
3k views

Why are virtual machines required?

Instead of compiling the source code for the respective OS (on which it is targeted), you compile once and run everywhere. For the sake of this question, I would call it VM (for example, both for ...
6
votes
6answers
4k views

Is there a language that transcompiles to C with a better syntax? [closed]

CoffeeScript is a language with a very clean Ruby-like syntax that transcompiles to JavaScript. Does the same thing exists with C? Then writing more readable and as fast as original C programs would ...
2
votes
4answers
542 views

How should I evaluate new browser languages?

In these days there are many projects whose aim is to bring new languages to the browser by compiling them to JavaScript. Among the others one can mention ClojureScript, CoffeScript, Dart, haXe, ...
6
votes
8answers
687 views

Are there any concrete examples of where a paralellizing compiler would provide a value-adding benefit? [closed]

Paul Graham argues that: It would be great if a startup could give us something of the old Moore's Law back, by writing software that could make a large number of CPUs look to the developer ...
2
votes
2answers
154 views

Syntax tree dump format

When writing a compiler, it is useful to include the ability to dump the abstract syntax tree in a human readable format, for debugging purposes. This output might also be useful for other tools like ...
3
votes
1answer
3k views

What would be the best way to learn about compilers, and executable formats? [duplicate]

I want to write my own compiler for my own language. Yes, it's going to be hard, and it will take long, but I think it will be worth it. I have looked into OSDev.org, and read about executable ...
16
votes
5answers
5k views

Interpreted vs Compiled: A useful distinction?

A lot of questions get asked here about interpreted vs compiled language implements. I'm wondering whether the distinction actually makes any sense. (Actually the questions are usually about ...
14
votes
4answers
27k views

Why doesn't Python need a compiler?

Just wondering (now that I've started with C++ which needs a compiler) why Python doesn't need a compiler? I just enter the code, save it as an exec, and run it. In C++ I have to make builds and all ...
5
votes
1answer
295 views

Visualizing a CUP grammar

I am implementing a grammar in CUP, and it would often be helpful to see everything at a glance. This could also be useful in finding errors quickly. Are there any programs out there that will ...
10
votes
2answers
605 views

Anyone know of any parallelizing compilers following the approach of the Dragon Book?

In Compilers: Principles, Techniques, & Tools, Aho et al describe an approach for optimizing for parallelism (chapter 11 in the second edition). Is anyone aware of any existing compilers which ...
15
votes
1answer
1k views

Are there any podcasts (not lectures) about compiler development?

There are several podcasts with lectures from universities. I am looking for "other" podcasts. So are there any non-lecture podcasts about compiler development?
3
votes
2answers
493 views

Google Closure Compiler - what does the name mean?

I am curious about the Google Closure Compiler. Why did they name it that? Does it have anything to do with lexical closures? EDIT: I tried researching it in the FAQ and documentation, as well as ...
2
votes
4answers
1k views

Computation Program Not Running at 100% CPU Utilization

I have a program which has a GUI and performs some very heavy mathematical computations for a couple of minutes and then outputs a result. When I try to directly interface it through its DLL's, it ...
8
votes
4answers
11k views

Writing a lexer in C++

What are good resources on how to write a lexer in C++ (books, tutorials, documents), what are some good techniques and practices? I have looked on the internet and everyone says to use a lexer ...
2
votes
2answers
27k views

How Does A Compiler Work? [closed]

Note: I am surprised that this hasn't been asked before, and if it has I could not find it in a search. I've been on tons of websites, I've read tons of articles, and I have heard tons of ...
8
votes
4answers
564 views

Why aren't VM languages compiled just once?

(First of all, I should make clear that compilers and virtual machines (aka) are a completely unknown field for me) As I understand it, every time a Java/C#/... application is run, a VM is invoked ...
7
votes
6answers
694 views

What is the industry definition of an interpreter (as opposed to a compiler)?

In my compiler design courses, I have learned about and worked with a clear academic definition of an interpreter and a compiler, with an interpreter being a program Pi from a language M capable ...
4
votes
3answers
1k views

Do You Have To Know CIL To Make A Compiler for .NET?

Assume one wants to create a simple .NET language, or slightly more difficult, a compiler for an existing .NET language. Do you absolutely need to be familiar with the CIL (Common Intermediate ...
2
votes
4answers
402 views

What programs emit C++ code and pass it to mainstream compilers?

I suspect there're programs that instead of emitting machine code instead emit C++ code and then start a mainstream C++ compiler to compile it to machine code. I can't find any notable examples ...
2
votes
1answer
880 views

Io (Language) IDE/Compiler [closed]

Can you recommend a free compiler/IDE for writing some simple Io programs? I want to learn the language at home in my spare time.
2
votes
3answers
250 views

Is it worth evaluating compiler optimization on trivial cases?

I'm currently testing Visual C++ 10 on some trivial pieces of code. For example, like this one (taken from here): int main() { int i; clrscr(); ...
34
votes
3answers
12k views

How could the first C++ compiler be written in C++?

Stroustrup claims that Cfront, the first C++ compiler, was written in C++ (Stroustrup FAQ). However, how is it even possible that the first C++ compiler be written in C++? The code that makes up the ...
11
votes
8answers
1k views

Are compilers used outside of development?

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. ...
5
votes
6answers
3k views

How can variables be created at runtime?

Is it possible to define variables dynamically? Last night I was writing some code (C and VB2010) and I ran into a problem related to defining variables in my program. The variables needed depend on ...
11
votes
2answers
993 views

What is the relationship between the Dynamic Language Runtime and C# 4.0?

Let's say I wanted to create a dynamic language compiler/interpreter, a Scheme interpreter perhaps, on the .NET platform as it exists today. Would I be better off using the Dynamic Language Runtime ...
4
votes
3answers
751 views

Role of linking, object files and executables

For a C or assembly program that does not require any other library, will linking be necessary? In other words, will conversion from C to Assembly and/or from Assembly to an object file be enough ...
3
votes
1answer
4k views

Understanding Application binary interface (ABI)

I am trying to understand the concept of Application binary interface (ABI). From The Linux Kernel Primer: An ABI is a set of conventions that allows a linker to combine separately compiled ...
12
votes
3answers
751 views

How does a static type system affect the design of a prototype-based language?

The Wikipedia article on prototype-based languages contains the following paragraph: Almost all prototype-based systems are based on interpreted and dynamically typed languages. Systems based on ...
1
vote
3answers
1k views

Compiler/OS Design - Where to start [closed]

I have a fairly strong background in C and Assembly and I am starting to look into basic compiler and operating systems design, but my biggest problem is where I should really start, seeing as both ...
6
votes
1answer
3k views

Is Objective-C an Interpreted or Compiled language?

I want to know if Objective-C is an interpreted or a compiled language.
10
votes
7answers
2k views

Which computer science subjects are required to follow introductory course in compilers? [closed]

I am non computer science undergraduate and work as a web-developer(java, python, AS3 etc.) as a professional. I take 1 course per semester at my local university. I had taken Artificial ...
1
vote
4answers
499 views

Does a prose to code compiler exist? [closed]

I have seen some horrible code in my time including people virtually duplicating the code in comments // add 4 to x x+=4; // for each i in 0 to 9 for (int i = 0; i < 10; i++) { // multiply x ...
3
votes
1answer
579 views

Is it possible to take a binary compiled for ARMv7 architecture and convert it to ARMv6?

Is it possible to take a binary compiled for ARMv7 architecture and convert it to ARMv6 ? Are there any tools that can do this?
4
votes
2answers
827 views

How do you write a code analysis & refactoring tool to interface with Visual Studio?

Recently while working on a project of mine and doing some refactoring I got an idea to write a custom tool to help me analyze my code in a very specific context and perform some very custom ...
9
votes
5answers
566 views

Basic features for a basic language? DSL suggestions?

I've finally begun to understand the complexity behind creating an interpreter and a compiler. I've built several versions of TinyBasic, 1964 (Dartmouth) Basic, and my own expansions on those ...
16
votes
4answers
2k views

GCC vs clang/LLVM — pros and cons of each [closed]

What are the pros and cons of GCC vs clang/LLVM?
5
votes
8answers
1k views

How useful are compile-time functions?

How useful are compile time functions? Personally I haven't worked in any language that supports them but they seem nifty in some cases. For those who don't what I mean, a compile-time function is ...
2
votes
6answers
418 views

What should be done when upgrading compiler introduces bug in existing project?

We've 4 embedded firmware at hand. Two of them are released, are in maintenance phase. Other two are going to be released. The released product uses OKI 411 micro, where as yet to be released products ...
10
votes
5answers
3k views

Do Fortran compilers really generate faster code than C compilers?

When I was studying in the university I often heard the idea that Fortran compilers produced faster code than C compilers for an equivalent program. The key reasoning went like this: a Fortran ...
19
votes
5answers
5k views

Are C++ templates just a kind of glorified macros?

From different comparisons among C++ templates and C#/Java generics like this one- ...
45
votes
19answers
4k views

How come compilers are so reliable?

We use compilers on a daily basis as if their correctness is a given, but compilers are programs too, and can potentially contain bugs. I always wondered about this infallible robustness. Have you ...
12
votes
13answers
1k views

Is it true that first versions of C compilers ran for dozens of minutes and required swapping floppy disks between stages?

Inspired by this question. I heard that some very very early versions of C compilers for personal computers (I guess it's around 1980) resided on two or three floppy disks and so in order to compile ...
14
votes
9answers
3k views

Career advice: PhD in theory of programming languages [closed]

I'm very interested in the theories of programming languages and going to apply a PhD in this topic, but I want to know more about the career after the graduate education. besides being a professor, ...
10
votes
4answers
3k views

Compiler Jobs - How Much Education Is Needed [closed]

I was motivated by the Compiler Construction As A Subject question and thought I would ask this one. I have heard from a few people that they have a good "compiler team" (don't ask where I heard it, ...
6
votes
6answers
2k views

What is the advantage of learning about and understanding compiler construction?

I'm a undergraduate in my 3rd year of a Software Engineering degree. From this year on, my university has introduced a new course called 'Compiler Constructions', which teaches you the basics of the ...
9
votes
2answers
840 views

How should compilers report errors and warnings?

I don't plan on writing a compiler in the near future; still, I'm quite interested with compiler technologies, and how this stuff could be made better. Starting with compiled languages, most ...
1
vote
1answer
380 views

How does compiler handle exceptions that are implicit? Looking for design strategies

Throughout the function handleException, the exception encountered is implicit. How does the compiler handle such implicit passing of exceptions? [For e.g. in C++ methods, this pointer is passed to ...