compiler

Traversing a binary tree in C

I'm trying to traverse a binary tree in C. My tree contains an AST node (abstract syntax tree node for compiler). ASTnode reserves nodetype which specifies given node's type (i.e INT OP or CHAR and TYPE we don't need to concern other types), the other members are left and right pointers, and finally we store. Here is code for traversing...

#include <> files in different files

if i have a several header files :lets say 1.h,2.h,3.h lets say the all the three header files have #include<stdlib.h> and one of the include files in them. when i have to use all 3 header files in a c file main.c it will have 3 copies #include<stdlib.h> after the preprocessor.how does the compiler handle this kind of conflict. is this...

How to generate AST from Java source-code?

As far as I know, the only way to parse Java source-code into an AST (Abstract Syntax Tree) is to use the Java Compiler Tree API: com.sun.source.tree I have two questions: What JDKs support com.sun.source.tree? Is there a portable replacement that works for all JDKs? ...

Objective-C: variable optimized away by compiler

I am trying to run the following code: 1. NSURL *checkLicenseURL = [NSURL URLWithString:@"check_license.php?accesskey=&license_key="]; // call server API 2. NSError *err = nil; 3. NSXMLDocument *xmlResult = [[NSXMLDocument alloc] initWithContentsOfURL:checkLicenseURL options:NSXMLDocumentTidyXML error:&err]; But when looking at variab...

Alternative Flex Compiler

Currently, as I'm sure most of you are aware, the Flex (EDIT: Flex 3) compiler is extraordinarily slow. It does however have an API. My question is: are there alternative (possibly C/C++ based) compilers that are faster than the current Adobe one? I realize compilers aren't something you can pump out in a few days, but if no alternat...

Java identifier resolution rules

What search order does the Java compiler use to resolve Foo in the following class? class Test { Foo f; } Empirical tests reveal the following search order: Nested classes Superclass nested classes java.lang.* classes Others? but I'd like to know where this is discussed in the Java Language Specification. ...

What causes java.lang.IncompatibleClassChangeError?

For some reason our java library that we package as a jar is throwing all of these java.lang.IncompatibleClassChangeError when we try to invoke methods from it. It seems to be seemingly random. What would cause this error? ...

Intel C++ compiler as an alternative to Microsoft's?

Is anyone here using the Intel C++ compiler instead of Microsoft's Visual c++ compiler? I would be very interested to hear your experience about integration, performance and build times. ...

What would you use to build a new compiler for .NET?

I'm working on a new toy language that will be statically compiled to .NET's IL code. Off hand I can think of the following to actually generate the IL, but I'm open to alternatives: Cecil ILASM ...

How does the C# compiler optimize a code fragment?

If I have a code like this for(int i=0;i<10;i++) { int iTemp; iTemp = i; //......... } Does the compiler instantinate iTemp 10 times? Or it optimize it? I mean if i rewrite the loop as int iTemp; for(int i=0;i<10;i++) { iTemp = i; //......... } Will it be faster? ...

What happens to identifiers in a program?

Hello, I'm a novice programmer. I just wanted to see output at different phases compilation, assembling & linking. I don't know assembly language also. I wrote a simple program #include <stdio.h> int humans = 9; int main() { int lions = 2; int cubs = populate(lions); return 0; } int populate(int crappy...

not clear with the job of the linker.

I'm using C language on windows. This question was previously part of http://stackoverflow.com/questions/1986549/what-happens-to-identifiers-in-a-program . I broke it to reduce no. of questions. This is a standalone query (doesn't depend on the previous question) If there is nothing to link (i.e.. I'm not using any libraries. I know it ...

Why is it important for C / C++ Code to be compilable on different compilers?

I'm interested in different aspects of portability (as you can see when browsing my other questions), so I read a lot about it. Quite often, I read/hear that Code should be written in a way that makes it compilable on different compilers. Without any real life experience with gcc / g++, it seems to me that it supports every major platf...

set visual studio 2008 compiler for c not c++

I have installed visual studio 2008 and i want to create some simple applications using C language. I do this by creating c++ console applications but i want the compiler to work for C not C++. Any way to accomplish this or i need another compiler if i want to deal with C? ...

Building LR(1) configuration lookahead

Hi all, I really have some troubles to cauculate the lookahead when building the LR(1) item sets, i had tried some lecture notes form different sites, but still... My example is S -> E + S | E E -> num | ( S ) The item set is I0: S’ -> . S $ S -> . E + S $ S -> . E $ E -> . num +,$ E -> . ( S ) +,$ I1: S ...

looking for transpiler: php to javascript

hello, i wonder, if there's any transpiler available, which converts (simple) php code to javascript? what i am not looking for is ajax stuff or javascript libraries imitating php functionality, but i am looking for a translater, which is able to generate javascript code from php code (similar of what google is doing with GWT and the j...

c gcc compiler options for pointer arithmetic warning

I m using the following flags , but still I m not able to get this warning: "pointer of type 'void *' used in arithmetic" Flags used: -O2 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-sign-compare -Wno-pointer-sign -Wno-attribut...

Assembly versus binary output

Is it better for a compiler to compile code to assembly language, or output binary machine code directly? Advantages of assembly language that I can think of off the top of my head: avoiding the need to learn the object file format, ease of debugging the backend. Advantage of binary: faster compile speed. How significant is this? Assum...

Understanding compiler error messages

Every language, and even different compilers for a given language, has a different set of error messages it will display when given poor input. Other than general debugging techniques, what are techniques you use when learning a new language to decipher the compiler error messages? ...

Compiler that recognize different-different languages and send them to their corresponding compilers. Possible ?

I was thinking whether it is possible to bridge asp.net, php and java to form a single page. Actually i dont need any such thing as of now. It was just an idea that stiked to my mind as some features of some languages are good and some features or some other languages are good, so i was thinking what if i combine all these features into...