A compiler is a computer program that transforms source code written in one programming language into another computer language.

learn more… | top users | synonyms (1)

2
votes
2answers
117 views

How to avoid compiling downtime

So, I'm used to developing in interpreted languages. I have been hired on to work in C#. I am familiar with compilation and can use it, however being able to work with interpreted languages has gotten ...
2
votes
3answers
181 views

How does Chrome V8 work? And why was JavaScript not JIT-Compiled in the first place?

I have been researching Interpreters/Compilers, then I stumbled across JIT-Compilation - specifically Google Chrome's V8 Javascript Engine. My questions are - How can it be faster than standard ...
-3
votes
0answers
27 views

How to compile Selenium on Debian Jessie, failing on ibus [closed]

When I compile Selenium on Debian Jessie, it gives me this output. I have ibus lib installed. I think that I use different version. I am right, how can I solve it? If you need to provide any ...
-1
votes
0answers
59 views

Is DJGPP in use anymore? [closed]

We are revising some makefiles that date back to the 1990s. The makefiles include support DJGPP (also see DJGPP on Wikipedia). If DJGPP is no longer a popular platform, then I would like to remove the ...
2
votes
2answers
41 views

Clean Abstract Syntax Tree

I'm writing a toy compiler for fun. Basically, my problem is that I don't want to clutter the AST with stuff like debug information (symbol tokens, locations of tokens, etc) as well as data that the ...
0
votes
0answers
66 views

Why are datatypes different in terms of bit size based on complier, and OS used

I was reading a tutorial on C++ as I am new to programming, and I was wondering why the sizeof operator gives different output depending on what you're programming with.
3
votes
3answers
254 views

Why does Python need both a compiler and an interpreter?

I can understand the fact that Java needs both a compiler and an interpreter. It compiles source code to bytecode and then a virtual machine (on Windows, on Linux, on Android, etc.) translates that ...
0
votes
3answers
99 views

Would it be possible to create a language similar to Ruby/Python with static typing that had the speed/memory usage of a compiled C program? [closed]

One of the main drawbacks of Ruby/Python is performance. I understand that they are interpreted and C is compiled. (And there are things like JRuby which do JIT compilation with Ruby). But they never ...
39
votes
13answers
5k views

How safe is it to compile a piece of source code from a random stranger? [closed]

Suppose I'm reviewing code that job applicants send to prove their skills. Clearly I don't want to run executables they send. Not so clearly I'd rather not run the result of compilation of their code ...
4
votes
5answers
723 views

Compilation to bytecode vs machine code

Does compilation that produces an interim bytecode (like with Java), rather than going "all the way" to machine code, generally involve less complexity (and thus likely take less time)?
30
votes
6answers
6k views

Why do programs use call stacks, if nested function calls can be inlined?

Why not have the compiler take a program like this: function a(b) { return b^2 }; function c(b) { return a(b) + 5 }; and convert it into a program like this: function c(b) { return b^2 + 5 }; ...
0
votes
0answers
59 views

Java platform vs Source/Binary format settings in Netbeans

I've just wanted to get to know what these particular settings really do: Project Properties -> Libraries -> Java Platform Project Properties -> Sources -> Source/Binary Format After a little bit ...
4
votes
1answer
121 views

Do java .class files have a lexer/parser?

I've been learning ANTLR, by writing my own (extremely simple!) programming language It made me curious about how the lexer/parser/AST is implemented for java. Obviously there is a grammar for .java ...
1
vote
1answer
136 views

How do Java AOT compilers work?

There are a few number of tools out there (Excelsior JET, etc.) that claim to transform Java app's into native executables (*.exe). However it is my understanding that these tools are really just ...
9
votes
8answers
1k views

What stops C from being compiled/interpreted/JIT'ed?

Java is often praised for its amazing portability, which I presume is because of the JVM. My question is what stops C from being being compiled/interpreted/JIT'ed.., if so, C can also be write once ...
0
votes
2answers
110 views

Difference between PyPy and JVM

From my understanding the default Python interpreter(CPython) compiles source code into bytecode and then interprets the bytecode into machine code. PyPy on the other hand makes use of JIT to optimize ...
3
votes
6answers
595 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, which makes me wonder that if I want ...
2
votes
1answer
68 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
172 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 ...
0
votes
1answer
150 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 ...
3
votes
3answers
226 views

How can I implement an 'if' statement in an interpreter?

If I were writing a compiler (say for a stack-based VM), the code for an if statement: if (<some_expression>) { <some_instructions> } Would be translated to the following ...
0
votes
1answer
144 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 ...
0
votes
0answers
57 views

Single import in a large file vs. multiple imports in smaller files. [Golang]

I'm sure the folks at Google worked long and hard to ensure the programmer wouldn't have to worry about details like this, but I'm curious. In Go if I have multiple files in the same package, but ...
6
votes
2answers
166 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
84 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
40 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
1k 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
278 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 ...
2
votes
2answers
221 views

When to use ANTLR and when to use a parsing library

I've always wanted to learn how to write a compiler - I've decided to use ANTLR, and am currently reading through the book (its very good by the way) I'm pretty new to this, so go easy, but the jist ...
4
votes
4answers
293 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 ...
2
votes
3answers
152 views

Will C compiler attach the whole object code of the header file?

When you compile a C source code does the compiler convert the whole header file to object code or just the functions of the header file you use? Like for example, in the header file #include ...
0
votes
1answer
139 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 ...
0
votes
3answers
445 views

Is functional language without runtime written in C possible? [closed]

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
150 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
153 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 ...
56
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
429 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 ...
0
votes
2answers
141 views

How are ASCII code associations actually stored and retrieved?

So, I was reading about bootstrapping, compilers, and the classic example of writing support for escape sequence support came up, where a program is written with a short snippet referring each escape ...
2
votes
0answers
64 views

Loop Unfolding and Named Significant Bits

I've been writing a Parser Compiler for the last seven or so years, and I recently got to the point (yet again, never satisfied) of structuring the portion dealing with the portions of the language ...
5
votes
3answers
281 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 ...
25
votes
4answers
5k 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 ...
1
vote
1answer
107 views

Allow user to enter DSL, rules or code?

I have a python library that allows me to define rules by chaining inputs and outputs of functions ( producer(grep(count( [print(),log() ] ))) This functions define a pipeline from left to right. ...
2
votes
1answer
93 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
51 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 ...
2
votes
3answers
169 views

Which components/phases of a JIT compiler are different from a traditional ahead of time compiler?

Besides a faster register allocation algorithm and some trade-off in control and data-flow analysis for optimization purposes, which components/phases of a JIT compiler are different from a ...
1
vote
2answers
78 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
317 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 ...
4
votes
2answers
304 views

Needs (in principle) C++ parenthesis around if statement condition?

In current C++ when body of if statements contain only one command then: Parenthesis around if condition are mandatory but block are optional. So, both examples are OK: if ( condition ) { return 0; ...
0
votes
1answer
165 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 ...
27
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 ...