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

-4
votes
0answers
40 views

x86 assembly books; but looking for something slightly different [on hold]

Are there Assembly tutorial books that clearly explain the relationships between a high level programming language and the x86 assembly language during compilation ? For example, I know a very good ...
1
vote
5answers
339 views

Should I use a source-to-source or a traditional compiler in order to develop my own Programming Language?

I'm really interested in writing my own general-purpose high-level programming language, but I'm somewhat confused. I know that Python and Ruby were written in C, but that makes me wonder: "If I want ...
2
votes
1answer
56 views

How do hybrid interpreter-JIT compilers work?

Chrome's V8 compiler, the Java HotSpot compiler, and many more have multiple tiers of interpretation and compilation. A function starts off as interpreted in HotSpot and then, if it is run often ...
1
vote
4answers
102 views

const reference and const pointer. How do they work?

I read a post about how const storage works. How does const storage work? (Item 2, Scott Myers Effective C++) This says that each segment has separate section of write protected memory and const ...
2
votes
0answers
145 views

Embox compilation and flashing [migrated]

I am interested in attempting to compile, package and flash Embox to an MCU, from either a Windows or Mac machine (cross-compilation), via JTAG, and I have a number of concerns. Observe what I ...
0
votes
1answer
91 views

AST processing and usefulness of visitor pattern

I know the visitor pattern is typically used to traverse a hierarchy of heterogeneous objects (inheriting a same abstract object) and dissociate the processing of these objects from the data within ...
0
votes
1answer
134 views

Is it bad to implement a language in other two languages? [closed]

Ok, so I have some understanding about parsers and compilers, at least the basics of how it works, and i've written a calculator and a really small toy language that compiles to another high-level ...
3
votes
1answer
108 views

What is the minimum practical definition for the Scheme language?

What is the smallest practical set of primitives that can be used to define the Scheme language? For example, map can be defined as (define (map proc lis) (cond ((null? lis) '()) ...
0
votes
0answers
37 views

Android runtime - does ART miss optimization opportunities over Dalvik?

Is ART a strict improvement over Dalvik, or there are optimizations that an ahead-of-time compiler will miss compared to JIT, but Google decide they don't matter in practice? For example, with JIT, ...
0
votes
0answers
34 views

Turn gfortran runtime errors into warnings

I'm attempting to debug some code which I'm writing as an extension to a much larger program. I'm pretty sure I'm corrupting memory somewhere, but for practical reasons (long run time), it's not ...
33
votes
6answers
977 views

Why was the Itanium processor difficult to write a compiler for?

It's commonly stated that Intel's Itanium 64-bit processor architecture failed because the revolutionary EPIC instruction set was very difficult to write a good compiler for, which meant a lack of ...
1
vote
1answer
249 views

How would a compiler turn an else-if cascade into a switch?

I don't like switch in C and its descendants. Maybe it's the need for a break or the clumsiness of the syntax requiring a shifting of mental gears, I don't know. Whatever the reason, I will almost ...
4
votes
4answers
277 views

Why use an enum to determine node type in a parse tree?

The Sun Compiler Tree API uses an interface called Tree as the parent of all the different kinds of parse tree nodes (assignments, if-statements, class declarations, etc.). A part of this interface is ...
0
votes
1answer
128 views

How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII? [closed]

I'm writing simple language compiler frond-end (based on LLVM) in C++, and I wonder how could language support encoding stuff? How can I (as compiler writer) support encoding? I need to know the ...
-1
votes
2answers
225 views

Is functional language without runtime written in C possible?

Every functional language that compiles to native code relies on quite big runtime written in C programming language (well at least ones that I know of, for example Haskell, OCaml, Gambit/Chicken ...
1
vote
1answer
146 views

Hypothetical : What restrictions will I need to add to Java so that I can remove its GC? [closed]

This is a hypothetical, yet very technically precise question I'm trying to ask all the compiler/static analysis programmers. I'm trying to understand the extent of prohibitive features I would need ...
1
vote
2answers
147 views

Do today's modern compilers perform run time checks?

This is regarding compilers. Do compilers perform run time dependency checks to decide to vectorize a loop ? In other words, do compilers trace through the logic as it would in run-time to ...
55
votes
5answers
11k views

Why are there so few C compilers?

C is one of the most widely-used languages in the world. It accounts for a huge proportion of existing code and continues to be used for a vast amount of new code. It's beloved by its users, it's so ...
0
votes
1answer
387 views

Why are language features more popular than compiler design? [closed]

If we had a universal interpreter for all available features of programming languages we could use a specializer to generate compilers for all languages. We could simply use any language as source (or ...
5
votes
3answers
258 views

Is prototypal inheritance inherently slower?

I see Javascript 6 will add traditional class based inheritance, and one argument I hear is that classes are inherently much faster than prototypes because they can be optimized away by the compiler ...
23
votes
4answers
4k views

Why doesn't Java have optimization for tail-recursion at all?

From what I have read: The reason is because it is not easy to determine which method will actually be called as we have inheritance. However, why doesn't Java at least have tail-recursion ...
2
votes
1answer
88 views

Managing types and conversions in a compiler

I am trying to determine how to manage types and conversions between types within a compiler that I am writing. The compiler is being written in C#. There are a number of different kinds of types. ...
1
vote
0answers
49 views

Advantages of tiling based instruction selection algorithms with tiles representing more than one machine instruction?

In Modern Compiler Implementation in C of A. Appel some instruction selection algorithms are discussed based on tiling an intermediate representation tree. Each tile (or tree pattern) expresses a ...
1
vote
2answers
71 views

Should benchmarks (to compare processors performance) be compiled with optimization CFLAGS?

I need to compare performance of 2 processors and I concluded I should benchmark then with several various tests. I'm currently using linpack (HPL) (because it's still well known and used for ...
3
votes
2answers
257 views

Is it always safe to shift bool values?

I stumbled about a Cppcheck warning (an inconclusive one), that I mistakenly used & instead of &&: /// @param code identifies the command. Only the lower 16 bits of are being processed ...
0
votes
1answer
148 views

(almost) Pure C instead of C preprocessor [closed]

Why isn't (almost) pure C used instead of the C preprocessor? Sure I understand it would be a little more verbose. For example: #define PI 3.14159 If we had regular C as preprocessor language, the ...
26
votes
3answers
3k views

Why might it be difficult to make a 64 bit version of a program?

In my short time programming, it has been trivial to compile any of my C++, Java, etc. for either a 32 or 64 bit machine so long as I have the full source for the program. But a lot of software is ...
26
votes
6answers
2k views

What are the caveats of implementing fundamental types (like int) as classes?

When designing and implenting an object-oriented programming language, at some point one must make a choice about implementing fundamental types (like int, float, double or equivalents) as classes or ...
0
votes
1answer
133 views

Can most compilers check for errors? [closed]

I am a beginner at programming; so far all the compilers I have used can check for errors, and can refer to the line with the error. Are there any compilers, maybe for a certain language, that do not ...
2
votes
1answer
209 views

Developing a compiler for a self made CPU Architecture

Recently ive been consumed by creating my own simple CPU architecture that at some point could be easily implemented in hardware (No FPGA, but actual Logic Gate circuits). Naturally to fulfill this ...
4
votes
2answers
606 views

Isn't there a chicken-and-egg issue since GCC is written in C++ itself?

Since 4.8 release, the C++ compiler GCC (the G++ part of it) is written not in C anymore, but in C++ itself. I have a hypothetical question on this. I wonder how to compile the C++ code of GCC on a ...
3
votes
2answers
181 views

Do compilers attach the Garbage Collector to the final executable?

Since the Garbage Collector is part of the language implementation (not OS, etc.), does the compiler has to attach the GC to the final executable? Or is it like a dependency that has to be already ...
1
vote
2answers
89 views

Enumerated types and their interpretation by compilers

It seems to me that a lot, if not most, compilers treat enumerated types as int underneath. In C/gcc, enums are compiled to int. In C#/Visual C#, you can change the underlying data type with something ...
3
votes
5answers
797 views

Creating a sort of 'in-language compiler'

I'm not saying I want to create a whole new compiler that's completely independent. I'm using C# Windows Forms and I want users to be able to write filtering syntax in a textbox withing my managed ...
4
votes
7answers
902 views

Why are self-hosting compilers considered a rite of passage for new languages?

I've heard in a number of places now that people expect languages to use, or at least have, a self-hosting compiler in order to deserve respect. I'm curious as to why this is. A compiler seems like a ...
0
votes
1answer
133 views

Significance of NFA in Compiler Design

While I was studying about Compiler Design it tells that we need 'finite automata' while designing a lexical analyzer like DFA or NFA. So I would like to know whether NFA is only used for conversion ...
0
votes
2answers
121 views

Optimizations in Compiler Design

While studying about Optimization in Compiler Design I went through an article that tells about 'Algebraic Simplification And Reassociation' in optimization.It tells that using this(algebraic ...
1
vote
0answers
281 views

First and Follow Algorithm in Compiler Design

While I was studying Compilers,I saw an example in first and follow that illustrated how to 'find the first and follow' non-terminals in a grammer. But I couldn't get how FOLLOW(E')=FOLLOW(E)={ $ ,) ...
2
votes
2answers
150 views

Do we really need auto-vectorization?

I am trying to understand automatic parallelization and a special case of that is auto vectorization. As I understand it auto-vectorization is more or less: The compiler takes parts of the code which ...
3
votes
1answer
235 views

What advantages are there to using Flex/Bison over just writing a compiler straight in a programming language?

I have written an Interpreter / Compiler simply as a programming algorithm using features such as recursive functions and concepts from finite-State machines. To me, these things are ideally suited to ...
0
votes
0answers
164 views

Best way to handle language interoperability

Background In a language like F#, direct interoperability with most other .NET languages is possible. For example, it is possible to use classes written in C# directly in F#, and it is possible to ...
9
votes
5answers
1k views

When does it make sense to compile my own language to C code first?

When designing an own programming language, when does it make sense to write a converter that takes the source code and converts it to C or C++ code so that I can use an existing compiler like gcc to ...
-2
votes
2answers
80 views

Debug symbols change application execution [closed]

I have to set up remote debugging for a multi threaded application running on a embedded device. C++ is the language. I've gotten so far and got the remote debugging working for a simple application, ...
17
votes
4answers
1k views

Why implement a lexer as a 2d array and a giant switch?

I'm slowly working to finish my degree, and this semester is Compilers 101. We're using the Dragon Book. Shortly into the course and we're talking about lexical analysis and how it can be implemented ...
4
votes
3answers
380 views

How do I compile my software for all platforms from Ubuntu Linux 64 bit?

I write a lot of open source software that I make available on my website. How do I get my software compiled for all relevant platforms including: Windows OS X Linux 32 bit deb Linux 64 bit deb ...
2
votes
1answer
321 views

Do compilers un-inline recurrent expressions?

Does a compiler look for recurrent expressions to convert it into 'function' to reduce binary size and improve performance? Of course, the obvious answer might be "some do it, some don't", so I ask ...
8
votes
5answers
741 views

Are C static libraries frowned upon? [closed]

There are 2 arguments for having shared libraries: It helps reduce disk space. When a shared library is updated, all the binaries depending on it get the update. There is mainly one drawback for ...
1
vote
2answers
239 views

Microchip XC8: How to pack code against an upper limit?

I have a project for a PIC16F1454 that needs some custom linking. Basically, I've separated my code into two parts that can be downloaded separately in the field and thus update (almost) all of the ...
2
votes
2answers
207 views

In which stage of compilation is “typedef” resolved by the compiler?

There are different stages of compilation Such as Preprocessing stage Syntax analysis Semantic analysis Intermediate Code generation Machine Code generation Optimization Linking My question here ...
4
votes
4answers
1k views

How does Python compile some its code in C?

I read that some constructs of Python are more efficient because they are compiled in C. https://wiki.python.org/moin/PythonSpeed/PerformanceTips Some of the examples used were map() and filter(). I ...