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
2answers
176 views

Building a tool to fix compiler errors automagically

When a program doesn't compile, error messages are sometimes esoteric. Often a simple Google search leading to a site like stack exchange solves the problem. Now why can't we automate this? How ...
26
votes
10answers
3k views

Can compilers and interpreters have bugs, and what can we (as users) do to deal with them? [closed]

If a compiler's work is essentially translating source code into machine level code, can there be any glitch in a compiler, i.e. a faulty "translation?" The same goes for an interpreter: can it fail ...
11
votes
2answers
588 views

Can and do compilers convert recursive logic to equivalent non-recursive logic?

I've been learning F# and it's starting to influence how I think when I'm programming C#. To that end, I have been using recursion when I feel the result improves readability and I can't envision it ...
12
votes
2answers
832 views

What does scannerless parsing have to do with the “Dangling Else Problem”?

I do not understand this sentence from the Wikipedia article on the Dangling Else problem: [The Dangling Else problem] is a problem that often comes up in compiler construction, especially ...
0
votes
2answers
555 views

embedding programming languages into other languages [duplicate]

In C/C++, there is a keyword that allows you to enter assembly language directly into a method. Example int Main() { __asm // notify the compiler that this block is assembly language. { ...
-1
votes
1answer
210 views

Recompiling a java project while it is running

I have a Java program that takes about an hour to run. While it is running, if I change the source code and recompile it, will this affect the above run?
2
votes
0answers
205 views

I want to write a data processing & analysis programming language that compiles to SAS. How to go about choosing a language to write my compiler in?

As a side project I wrote a simple macro in SAS to add syntatic sugar to SAS code. I hate how verbose SAS is sometimes! So my macro looks like this %macro md(code); /* expects a superquoted ...
0
votes
2answers
2k views

How would I make a compiler in C++? [closed]

This probably been asked for but I can't google "How to make a compiler in C++" because I will just get "How to compile C++" as the results. Anyway, for my question, I'd like to make a simple ...
1
vote
1answer
234 views

Cross Compile Arm Program to Intel

I have searched around for a way to run a program meant for ARM processors on an Intel computer, but I can only find ways to do the reverse, to compile Intel programs for ARM. Are there any ...
11
votes
1answer
462 views

Disadvantages of functional intermediate form

I'm writing an optimizer for a language similar to JavaScript, and need to choose an intermediate code representation. The obvious/typical choice these days is Static Single Assignment (SSA). ...
7
votes
5answers
432 views

Is it a good idea to read compiler source code? [closed]

I'm a junior in college majoring in Computer Science. Apart from writing lots of code, I want to start reading source code written by others to improve my coding skills and learn better/different ways ...
4
votes
1answer
1k views

Homogeneous vs. heterogeneous AST representation

What are the reasons to choose a homogeneous vs. a heterogeneous AST representation for implementing a complex domain-specific programming language? Just to be very clear about what I'm asking, here ...
0
votes
4answers
126 views

Use functions inside a loop declaration

What's the best practice? This : for ($i = 0; $i < count($array); $i++) { //stuff } Or, what I usually do : $count = count($array); for($i = 0; $i < $count; $i++) { //stuff } Is it the ...
10
votes
4answers
1k views

Is it possible to use the Intel C/C++ compiler on Linux to create object files to be linked on Windows?

Why? Depending on your source the Intel compiler is likely or most definitely the compiler generating the fastest executables for the x86 architecture (5 to 100 % execution time improvement). Intel ...
-3
votes
2answers
327 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
243 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
936 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?
33
votes
11answers
3k 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. ...
19
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 ...
9
votes
2answers
940 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
138 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
579 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
2k 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
219 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
478 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
314 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
994 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
423 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
391 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. ...
-1
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
672 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
371 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
328 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
245 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
707 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
210 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
640 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
5answers
330 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
598 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 ...
3
votes
2answers
802 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 ...
0
votes
0answers
60 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?)
22
votes
5answers
28k 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
165 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
892 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 => ...