compiler

Why is import of class not needed when calling method on instance (Java)

Something that's confused me - an example: Thing.java: import java.util.Date; class Thing { static Date getDate() {return new Date();} } (same package) TestUsesThing.java: // not importing Date here. public class TestUsesThing { public static void main(String[] args) { System.out.println(Thing.getDate().getTime(...

Trying to no-op an instruction

Is it possible using GNU tools (gcc, binutils, etc) to modify all occurrences of an assembly instruction into a no-op? Specifically, gcc with the -pg option generates the following assembly (ARM): 0x0: e1a0c00d mov ip, sp 0x4: e92dd800 stmdb sp!, {fp, ip, lr, pc} 0x8: e24cb004 sub fp, ip, #4 ; 0x4 0xc: ebfffffe bl 0 <mco...

Documentation on creating a programming language

Duplicate of Learning to write a compiler and What are the best resources on designing a new language? Can you point to what you think is the best documentation on creating a new programming language (--apart from the Dragon book, which I know of already). I am interested in both scripting language and general programming language desig...

searching strings for keywords: questions about the "failure function"

I've got a question on failure function description from "Compilers: Principles, Techniques, and Tools" aka DragonBook Firstly, the quote: In order to process text strings rapidly and search those strings for a keyword, it is useful to define, for keyword b1b2...bn, and position s in that keyword , a failure function, f (s) ... ...

CompilerParameters.ReferencedAssemblies -- Add reference to System.Web.UI.WebControls

I am compiling classes at run-time using the CodeDomProvider class. This works fine for classes only using the System namespace: using System; public class Test { public String HelloWorld() { return "Hello World!"; } } If I try to compile a class using System.Web.UI.WebControls though, I get this error: {error...

What do people mean when they say C++ has "undecidable grammar"?

What do people mean when they say this? What are the implications for programmers and compilers? ...

Visual Studio Debugging/Building

I have a solution that has a plain old asp.net website and a winforms app. I have the winforms app set as my startup application. When I press (CTRL+)F5, it just runs the app without building. So, my changes aren't built into the program. What should I do to fix this? EDIT I don't want to have to go to the build menu and then debug....

C++ iterators & loop optimization

I see a lot of c++ code that looks like this: for( const_iterator it = list.begin(), const_iterator ite = list.end(); it != ite; ++it) As opposed to the more concise version: for( const_iterator it = list.begin(); it != list.end(); ++it) Will there be any difference in speed between these two conventions? Naively the...

Should I look at the bytecode that is produce by a java compiler?

No The JIT compiler may "transform" the bytecode into something completely different anyway. It will lead you to do premature optimization. Yes You do not know which method will be compiled by the JIT, so it is better if you optimize them all. It will make you a better Java programmer. I am asking without really knowing (obviou...

Callee save with the caller passing the used registers?

In compiler design, why instead of having a caller or callee register saving arrangement, couldn't the caller pass its list of used registers (that it would push in case of a caller saving arrangement) to the callee so that the callee can compare its list of used registers to the registers used by the caller. Then only the registers that...

C compiler asserts - how to implement?

I'd like to implement an "assert" that prevents compilation, rather than failing at runtime, in the error case. I currently have one defined like this, which works great, but which increases the size of the binaries. #define MY_COMPILER_ASSERT(EXPRESSION) switch (0) {case 0: case (EXPRESSION):;} Sample code (which fails to compile). ...

How to tell if a binary is release or debug in both win and *nix.

Is there a simple command line utility to inspect binaries like executable and dynamic libraries to tell if they are release or debug versions? Is there anything like that on *nix or windows? ...

What is the best language to write a compiler in?

What is the best language to write a compiler in (not for)? ...

Is it worth switching to IBM Jikes (java) compiler

I just read in some Liferay documentation that IBM's Jikes (java) compiler is faster and more descriptive with compile time errors. I would like to know whether the community agrees, and whether the switch makes any noticeable improvement in your productivity. ...

Python's bz2 module not compiled by default.

It seems that Python 2.6.1 doesn't compile bz2 library by default from source. I don't have lib-dynload/bz2.so What's the quickest way to add it (without installing Python from scratch)? OS is Linux 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+tg+++opt+c8+gr2b-v6.194 #1 SMP Tue Jun 6 15:52:09 PDT 2006 i686 GNU/Linux IIRC I used only --prefi...

Can a language be turing complete but incomplete in other ways?

For example, are there certain things when writing an operating system that cannot be accomplished in a turing complete language? ...

Strongly typed Lua

I am looking for a Lua front-end compiler that is strongly-type, but outputs standard Lua 5.1 byte-code (that has no notion of types at all). What I want is a decent amount of static, compile-time syntactic analysis and optional typing, to detect trivial errors sooner than run-time. The resulting byte-code would have to play nicely wit...

Source Code Translator

I have to write program in C#, that converts from C++ source code to C# code. Is there any idea where to start? Do i have to use parser tree? Thanks! ...

C calendar structure

Hi, could someone take a quick look at this C code and see why I get the compiler error? It is a function for entering details into a calendar structure, and should create one node, i.e. one 'event' on the calendar. struct event enter_key(void) { int day,month,year,starttime,endtime,length; char* descp; struct event*...

How to install DJGPP

I am brand new to C and programming. I would like to use DJGPP as my compiler at this point. How can I install it? From what I understand it is multiple files. I cant seem to find a site that actually has the files that has working links. Thank you! I am on Windows Vista. ...