compiler

Targetable Compiler for Arbitrary Architecture

Are there compilers for high-level languages (such as C) which can be targeted to various architectures by specifying the hardware resources of the target? I'm wondering if there are compilers which can target an architecture by specifying features such as the available registers and instruction set of the processor (i.e. how each instr...

Constructing a simple interpreter

Hello, I’m starting a project where I need to implement a light-weight interpreter. The interpreter is used to execute simple scientific algorithms. The programming language that this interpreter will use should be simple, since it is targeting non- software developers (for example, mathematicians.) The interpreter should support basic...

Compiler optimizations: Where/how can I get a feel for what the payoff is for different optimizations?

In my independent study of various compiler books and web sites, I am learning about many different ways that a compiler can optimize the code that is being compiled, but I am having trouble figuring out how much of a benefit each optimization will tend to give. How do most compiler writers go about deciding which optimizations to imple...

Back-end choice for a new dynamic programming language?

I've been developing a Smalltalk variant for just the fun of it and I wonder what would be a fellow stackoverflowers choice when it comes to targeting a back-end. These were my current considerations: .NET, JVM: These two VM's are mainly for statically typed languages and I assume it would be quite hard to target such a dynamic language...

Is it costly to do array.length or list.count in a loop

I know that in JavaScript, creating a for loop like this: for(int i = 0; i < arr.length; i++) is costly as it computes the array length each time. Is this behavior costly in c# for lists and arrays as well. Or at compile-time is it optimized? Also what about other languages such as Java, how is this handled? ...

Why are C++ methods sometimes defined inside classes?

I frequently run into large, non-template classes in C++ where simple methods are defined directly in the class body in the header file instead of separately in the implementation file. For example: class Foo { int getBar() const { return bar; } ... }; Why do this? It seems like there are disadvantages. The implementation is not a...

Nested templates gcc compiler 4.1.2 error

I'm trying to create a template class to insulate the users from a data type. I would have preferred to use an adapter class, but the function signatures needed to change requiring a template. In the code sample below(not the actual project just a simplified version to illustrate the problem), while in the main routine I'm able to use ...

How can I convert from integers to roman numerals using a syntax-directed translation scheme?

I'm reading the dragon book (just starting for now), and I found this exercise which I can absolutely not solve. I understand the concept, but building a context-free grammar for this looks like way out of my league. NOTE: I'm not taking a Compiler class in College and trying to cheat. I'm just reading the dragon book and this exercise ...

Determine target architecture of binary file in Linux (library or executable)

We have an issue related to a Java application running under a (rather old) FC3 on a Advantech POS board with a Via C3 processor. The java application has several compiled shared libs that are accessed via JNI. Via C3 processor is suppossed to be i686 compatible. Some time ago after installing Ubuntu 6.10 on a MiniItx board with the sam...

Delphi 2009 where is the 'treat warnings as errors' option?

In Delphi 2009 whereabouts do you turn on the option to treat warnings as errors? ...

Buildfarms : Options

Hi all, We use Incredibuild here to compile our code in a distributed fashion. I was wondering if there are any open source (or free) alternatives to use on a home network? Failing that, are there any other simple solutions with good integration with Visual Studio out there? EDIT: I should say that I am quite happy to get my hands d...

Will the c++ compiler optimize away unused return value?

If I have a function that returns an object, but this return value is never used by the caller, will the compiler optimize away the copy? (Possibly an always/sometimes/never answer.) Elementary example:ReturnValue MyClass::FunctionThatAltersMembersAndNeverFails() { //Do stuff to members of MyClass that never fails return success...

How to suppress compiler warning for specific function in VS2005 (VB.Net)

I have a class that inherits from a base class and implements the following... Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo Now the base class it inherits from also implements this System.IComparable.CompareTo so I'm getting the following compiler warning: Warning: 'System.ICom...

Can someone tell me the very basics of how computer programming works?

Basically, my question is what makes all the words of a programming language actually do anything? I mean, what's actually happening to make the computer know what all of those words mean? If I verbally tell my my computer to do something, it doesn't do it, because it doesn't understand. So how exactly can these human words written into ...

How to stop VS2008 trying to compile .ASP pages as Visual Basic?

I have a website with a mix of ASP (classic) and ASP.NET pages. For some reason Visual Studio (specifically 2008 Pro) keeps trying to compile the ASP classic pages. How do I prevent it from trying to compile the .asp pages? Reason: I'm getting a ton of errors on a specific .asp file that includes a Class. I believe it's trying to comp...

What is the best compiler to use when you want to experiment with C++0x features?

What is the best compiler to experiment with C++0x features? I have been experimenting with GNU g++ 4.4. ...

C++ compiler optimization of passed arguments

I'm using a logging module that can have reporting enabled/disabled at runtime. Calls generally go something like: WARN( "Danger Will Robinson! There are " + boost::lexical_cast<string>(minutes) + " minutes of oxygen left!" ); I'm using an inline function for WARN, but I'm curious as to how much optimization is going on...

What are the implications of using /Zi vs /Z7 for Visual Studio C++ projects?

Background There are several different debug flags you can use with the Visual Studio C++ compiler. They are: (none) Create no debugging information Faster compilation times /Z7 Produce full-symbolic debugging information in the .obj files using CodeView format /Zi Produce full-symbolic debugging information in a .pdb file for th...

Are there any decent compiler web services?

Here's the idea: you commit your code to a repository and call a web service (or enter the request through a web app) to have it compiled. The results are then pushed up to a FTP server, S3 bucket, etc. Is there anything like this out there on the public internet? TFS has a build queuing feature, but I'm thinking more along the lines ...

Do there exist any compilers with localized versions of programming languages?

I have often wondered why it is that non-English speaking programmers are forced to use a different language when programming when it would seem to be so easy to offer an IDE that could replace keywords with localized versions. Why can't the Germans use a "während..macht" loop? Do programmers in Japan, Germany, France, Spain, Botswana j...