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

-3
votes
2answers
416 views

Why do people tend to gravitate to older versions of visual studio? [closed]

I'm starting to pick up all of the perks of C++11, and being a 2010 user i'm considering installing 2012 instead for better c++11 support. But why is it that 2012 doesn't seem as popular as 2010? Am i ...
10
votes
3answers
1k views

Writing a Compiler Compiler - Insight on Use and Features

This is part of a series of questions which focuses on the sister project to the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. The ...
0
votes
2answers
281 views

How the cross programming language compiler or translator works [closed]

These days there are more cross programming language compilers (specially from some 'X' language to JavaScript). I wonder how these are developed? What are the general steps to be taken care to write ...
3
votes
1answer
1k views

What is the Ken Thompson Hack? [duplicate]

I read some stuff like cm bell labs but i couldn't get it all. How does it work really? What is the logic in that?
34
votes
10answers
4k views

What is the difference between “Syntax” and “Syntactic Sugar”

Background The Wikipedia page on Syntactic Sugar states: In computer science, syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. ...
20
votes
2answers
7k views

What is ASM.js and what does it mean for everyone?

I'm starting to hear rumblings about this project called ASM.js. Currently their web site is terrible and confusing. Here's what I know from my research on the web. It is a subset of JavaScript that ...
11
votes
3answers
1k views

Why can't a compiler avoid importing a header file twice by its own?

New to C++! So I was reading this: http://www.learncpp.com/cpp-tutorial/110-a-first-look-at-the-preprocessor/ Header guards Because header files can include other header files, it is possible ...
2
votes
1answer
139 views

upgrading to newer version of compiler [closed]

I had legacy code that was originally build for some quite old version of compiler. We are talking about native code, not managed. Now it is ported to almost newest version of the compiler. Every ...
10
votes
3answers
666 views

How to implement lazy evaluation of if()

I am currently implementing an expression evaluator (single line expressions, like formulas) based on the following: the entered expression is tokenized to separate literal booleans, integers, ...
12
votes
7answers
3k views

When to pay for C++ compilers [closed]

Recently I have began to wonder when developers should pay for compilers. Compilers come for free with most platforms or there is a free version easily obtainable. Example: OS X - GCC and Clang/LLVM ...
2
votes
2answers
224 views

Are there any practical uses of allowing recursive inclusion of a file?

I am currently implementing NASM-like preprocessor for my assembler, and I am wondering what is the correct way of handling recursively included files. From what I see, there are two ways to deal with ...
-5
votes
3answers
491 views

How is an IDE compiled? [closed]

I'd like to know the general procedure of how an IDE is built/compiled/created. Additionally, what are some tools/scripts used to create an IDE? I don't mean to say that compiling IDE needs an IDE. ...
3
votes
2answers
318 views

What happens when using address before it's allocated?

The very simple piece of C++ code below is incorrect, it's easy to see why and tools like Valgrind will tell you. In running several C++ codes containing this kind of error, I noticed that each time, ...
18
votes
4answers
1k views

Detecting misusage of delete[] vs. delete at compile time

I'd like to know if it's possible to detect the delete error commented below at compile time? Especially, I'd like to hear about g++ compiler. ClassTypeA *abc_ptr = new ClassTypeA[100]; ...
8
votes
2answers
519 views

What is the current state of SECD and SKI machine use and research? [closed]

I'm doing some independent research/study with a professor who's a very functional guy. The goal is to examine more of what's happening behind the scenes with functional languages than we normally ...
3
votes
1answer
415 views

Online compilers and repls - not one big security hole?

There are plenty of compilers and REPL services on the web. For example: Fay ide. I find that implementing some similar technology would be very interesting. But it seems like a major security hole. ...
0
votes
1answer
2k views

Fastest native C++ multi-platform compiler & IDE & debugger [closed]

If I'll begin developing cross platform applications, The complied file speed is very important for me . I have research before than and find same result about IDE : (I ignored eclipse because very ...
2
votes
2answers
1k views

Convert grammar into an LL(1) grammar which recognises the same language

I have the following sample question for a compilers exam and wanted to check my solution. Convert the following grammar into an LL(1) grammar which recognises the same language: E -> E + T E ...
0
votes
0answers
456 views

Steps in converting a grammar to LL(1) Grammar

I have the following question: Convert the following grammar into an LL(1) grammar which recognises the same language (you may assume that the grammar is unambiguous). A -> int A -> int + A A ...
5
votes
3answers
378 views

Constructing a Finite State Automaton

I have an exam question that I am unsure of the answer. The question is: In organisation X valid user names have the following structure. The user name can be either the employee’s name followed ...
3
votes
1answer
259 views

Showing a grammar is ambiguous

I have the following question taken from a compilers course exam: Show that the following grammar is ambiguous. S = XcY X = a Y = b | Z Z = bW W = d | ϵ I drew the following tree: Am I correct ...
3
votes
1answer
982 views

Constructing a Deterministic Finite State Automaton for a given Regex

I have a couple of exam questions for my compilers class and wanted to check if my solutions are correct. The first question is: Consider a language in which numbers start with an optional minus ...
2
votes
1answer
215 views

What follows after lexical analysis?

I'm working on a toy compiler (for some simple language like PL/0) and I have my lexer up and running. At this point I should start working on building the parse tree, but before I start I was ...
6
votes
4answers
721 views

Is the output of Eclipse's incremental java compiler used in production? Or is it simply to support Eclipse's features?

I'm new to Java and Eclipse. One of my most recent discoveries was how Eclipse comes shipped with its own java compiler (ejc) for doing incremental builds. Eclipse seems to by default output ...
19
votes
5answers
1k views

Is Google Closure a true compiler?

This question is inspired by the debate in the comments on this Stack Overflow question. The Google Closure Compiler documentation states the following (emphasis added): The Closure Compiler is a ...
0
votes
4answers
355 views

Is comparing an OO compiler to a SQL compiler/optimizer valid?

I'm now doing a lot of SQL development at my new job where as before I was doing Object Oriented desktop app stuff. I keep running across very large scripts (thousands of lines) and wanting to ...
4
votes
3answers
820 views

Prerequisites to compiler theory? [closed]

It's not meant to be subjective or get advice on what would be the best path to take, but an objective list of things that must be known in order for me to pick up a book on compiler theory and ...
4
votes
2answers
985 views

How is it possible to write the compiler of a programming language with that language itself [duplicate]

Possible Duplicate: How could the first C++ compiler be written in C++? You probably heard that Microsoft released a new language called TypeScript which is a the typed superset of ...
1
vote
0answers
65 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
264 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?)
39
votes
5answers
50k 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
173 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
1k 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
12k 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
272 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
836 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
537 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
205 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
1k 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
386 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
710 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 ...
46
votes
9answers
18k 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
322 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
541 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, ...