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

0
votes
0answers
63 views

Built-in Context-and-Input-to-Output-Hashing in Compilers

Why doesn't (open source) compilers contain builtin funtionality for (shared) caching and reuse-fetching (using SHA1-hash of compiler-version, build-flags, target-platform and inputs) of executable ...
-3
votes
5answers
260 views

How do I make a .sh file that counts each time you compile? [closed]

I wanted to compile my program and I wanted to know how many times I have compiled it. How do I make a .sh file to do that? (I'm using mac, is it .sh file?)
24
votes
5answers
34k views

How to write a very basic compiler

Advanced compilers like gcc compile codes into machine readable files according to the language in which the code has been written (e.g. C, C++, etc). In fact, they interpret the meaning of each codes ...
0
votes
2answers
167 views

Calculations in Vector Register

How do vector registers work in terms of calculations and alloting data to them ? Is there a detailed reference available somewhere explaining how vector registers work and how data is fetched from ...
2
votes
5answers
2k views

How are operators organized in memory

How are operators organized/saved in the memory in context of a programming language. Are they procedures/functions saved somewhere and compilers just manipulate things to call these procs whenever ...
4
votes
4answers
941 views

Could implicit static methods cause problems?

This is a purely hypothetical question. Say I create a class method that contains no references to instance variables or other resources. For example (C#): protected string FormatColumn(string ...
13
votes
3answers
10k views

Why would more CPU cores on virtual machine slow compile times?

[edit#2] If anyone from VMWare can hit me up with a copy of VMWare Fusion, I'd be more than happy to do the same as a VirtualBox vs VMWare comparison. Somehow I suspect the VMWare hypervisor will be ...
0
votes
3answers
269 views

Dynamic choice of compilers?

An application has the following logic: client => created *.cpp => sent to the server => cl.exe + *.cpp = *.exe client => created *.cs => sent to the server => csc.exe + *.cs = *.exe client => ...
2
votes
1answer
754 views

High-level language to assembly

If assembly language is only a readable way to represent machine code, then why are HLLs converted to assembly first and then to machine code? Shouldn't HLLs be directly converted to machine code?
7
votes
3answers
489 views

Compiler Linking: How to handle circular references?

I'm currently writing a compiler for a new language and I'm struggling with the linking aspect of new Types when there exists a circular reference. I've created a dependency tree so that I can ...
3
votes
1answer
193 views

How to support mixed grammars?

I am currently writing a grammar for a programming language (PowerBuilder) and I am also collecting documentation about parsing and compilers creation. Now I would like to add in my grammar (that ...
4
votes
2answers
1k views

Whats the difference between an interpreted language and one compiled to a VM? [duplicate]

It occurs to me that there's not a heck of a lot of difference between $>python module.py And: $>javac module.java $>java module.class The former compiles to an intermediate language ...
6
votes
4answers
954 views

Writing a new programming language - when and how to bootstrap datastructures?

I'm in the process of writing my own programming language which, thus far, has been going great in terms of what I set out to accomplish. However, now, I'd like to bootstrap some pre-existing data ...
15
votes
6answers
2k views

What came first, the compiler, or the source?

I'm curious about the birth of the compiler. How did programming begin? Did people first build hardware that recognized a certain set of commands, or did people define a language and then build ...
1
vote
2answers
354 views

GCC: assembly listing for IA64 without an Itanium machine

I need to try the following thing: I would like to compile some simple C code samples and see the assembly listing generated by GCC for IA64 architecture, i.e. I just want to run GCC with the -S ...
4
votes
9answers
705 views

Why are effect-less functions executed?

All the languages I know of would execute something like: i = 0 while i < 100000000 i += 1 ..and you can see it take a noticeable amount of time to execute. Why though, do languages do ...
40
votes
9answers
14k 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 ...
12
votes
6answers
2k 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
0answers
143 views

CoffeeScript translates to JavaScript. Is there something like it for C? [duplicate]

Possible Duplicate: Is there a language that transcompiles to C with a better syntax? There are many language implementations which compile to C. However, most of them have some language ...
2
votes
4answers
292 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
2k 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
531 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, ...
7
votes
8answers
642 views

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

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
145 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
2k 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
4k 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 ...
13
votes
4answers
19k 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
288 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
603 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
473 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 ...
1
vote
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
9k 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
21k 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
554 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
648 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 ...
3
votes
3answers
937 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
381 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 ...
3
votes
1answer
758 views

Io (Language) IDE/Compiler

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
240 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(); ...
31
votes
3answers
9k 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
7answers
2k 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
886 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
689 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
3k 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 ...
11
votes
3answers
686 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.